Mercurial > hg > octave-lyh > gnulib-hg
changeset 11928:fb9478b0ba39
fchdir: fix off-by-one bug in previous patch
* lib/fchdir.c (rpl_fstat): Use correct bounds.
(_gl_unregister_fd): Delete useless if.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Tue, 01 Sep 2009 10:06:44 -0600 |
parents | 234941dec230 |
children | 0e6b6e9d54d0 |
files | ChangeLog lib/fchdir.c |
diffstat | 2 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-09-01 Eric Blake <ebb9@byu.net> + + fchdir: fix off-by-one bug in previous patch + * lib/fchdir.c (rpl_fstat): Use correct bounds. + (_gl_unregister_fd): Delete useless if. + 2009-09-01 Daniel P. Berrange <berrange@redhat.com> maint.mk: sort the list of syntax-check rules
--- a/lib/fchdir.c +++ b/lib/fchdir.c @@ -93,8 +93,7 @@ { if (fd >= 0 && fd < dirs_allocated) { - if (dirs[fd].name != NULL) - free (dirs[fd].name); + free (dirs[fd].name); dirs[fd].name = NULL; dirs[fd].saved_errno = ENOTDIR; } @@ -126,7 +125,7 @@ int rpl_fstat (int fd, struct stat *statbuf) { - if (0 <= fd && fd <= dirs_allocated && dirs[fd].name != NULL) + if (0 <= fd && fd < dirs_allocated && dirs[fd].name != NULL) return stat (dirs[fd].name, statbuf); return fstat (fd, statbuf); }