From: Adam Heath Date: Sat, 10 Mar 2001 22:00:13 +0000 (+0000) Subject: Use a pure file descriptor, instead of a stream, to load the data, in X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b62bef0829612b0f965b80c046655e6e04fa112;p=dpkg Use a pure file descriptor, instead of a stream, to load the data, in ensure_packagefiles_available. --- diff --git a/ChangeLog b/ChangeLog index 55d38134..94b7e177 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Mar 10 15:59:39 CST 2001 Adam Heath + + * main/filesdb.c: Use a pure file descriptor, instead of a stream, to + load the data, in ensure_packagefiles_available. + Sat Mar 10 01:33:15 CET 2001 Wichert Akkerman * main/main,h, main/main.c: add --no-debsig option using f_nodebsign diff --git a/main/filesdb.c b/main/filesdb.c index 4e1661ad..996c4bf7 100644 --- a/main/filesdb.c +++ b/main/filesdb.c @@ -60,7 +60,7 @@ static int saidread=0; void ensure_packagefiles_available(struct pkginfo *pkg) { static struct varbuf fnvb; - FILE *file; + int fd; const char *filelistfile; struct fileinlist **lendp, *newent, *current; struct filepackages *packageslump; @@ -118,9 +118,9 @@ void ensure_packagefiles_available(struct pkginfo *pkg) { onerr_abort++; - file= fopen(filelistfile,"r"); + fd= open(filelistfile,O_RDONLY); - if (!file) { + if (fd==-1) { if (errno != ENOENT) ohshite(_("unable to open files list file for package `%.250s'"),pkg->name); onerr_abort--; @@ -135,14 +135,14 @@ void ensure_packagefiles_available(struct pkginfo *pkg) { return; } - push_cleanup(cu_closefile,ehflag_bombout, 0,0, 1,(void*)file); + push_cleanup(cu_closefd,ehflag_bombout, 0,0, 1,(void*)fd); - if(fstat(fileno(file), &stat_buf)) + if(fstat(fd, &stat_buf)) ohshite("unable to stat files list file for package `%.250s'",pkg->name); loaded_list = nfmalloc(stat_buf.st_size); loaded_list_end = loaded_list + stat_buf.st_size; - fd_buf_copy(fileno(file), loaded_list, stat_buf.st_size, _("files list for package `%.250s'"), pkg->name); + fd_buf_copy(fd, loaded_list, stat_buf.st_size, _("files list for package `%.250s'"), pkg->name); lendp= &pkg->clientdata->files; thisline = loaded_list; @@ -164,8 +164,8 @@ void ensure_packagefiles_available(struct pkginfo *pkg) { lendp= &newent->next; thisline = nextline; } - pop_cleanup(ehflag_normaltidy); /* file= fopen() */ - if (fclose(file)) + pop_cleanup(ehflag_normaltidy); /* fd= open() */ + if (close(fd)) ohshite(_("error closing files list file for package `%.250s'"),pkg->name); if (fnvb.used) ohshit(_("files list file for package `%.250s' is truncated"),pkg->name);