* lib/fchdir.c (rpl_fstat): Use correct bounds.
(_gl_unregister_fd): Delete useless if.
Signed-off-by: Eric Blake <ebb9@byu.net>
+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
{
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;
}
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);
}