Mercurial > hg > octave-kai > gnulib-hg
changeset 14676:ead32d10a3f0
fclose: reduce dependencies
In an LGPLv2+ project, the last change to fclose dragged in
inappropriate modules.
* modules/fclose (Depends-on): Switch from fflush/fseeko to
simpler lseek.
* lib/fclose.c (rpl_fclose): Likewise.
Reported by Simon Josefsson.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Mon, 02 May 2011 11:41:12 -0600 |
parents | d214c42cc3fe |
children | fa93679417c1 |
files | ChangeLog lib/fclose.c modules/fclose |
diffstat | 3 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-05-02 Eric Blake <eblake@redhat.com> + fclose: reduced dependencies + * modules/fclose (Depends-on): Switch from fflush/fseeko to + simpler lseek. + * lib/fclose.c (rpl_fclose): Likewise. + Reported by Simon Josefsson. + exit: drop remaining clients * modules/argmatch (Depends-on): Replace exit with stdlib. * modules/copy-file (Depends-on): Likewise.
--- a/lib/fclose.c +++ b/lib/fclose.c @@ -33,8 +33,10 @@ int saved_errno = 0; /* We only need to flush the file if it is not reading or if it is - seekable. */ - if ((!freading (fp) || fseeko (fp, 0, SEEK_CUR) == 0) && fflush (fp)) + seekable. This only guarantees the file position of input files + if the fflush module is also in use. */ + if ((!freading (fp) || lseek (fileno (fp), 0, SEEK_CUR) != -1) + && fflush (fp)) saved_errno = errno; if (close (fileno (fp)) < 0 && saved_errno == 0)