/* chown-core.c -- core functions for changing ownership.
- Copyright (C) 2000, 2002 Free Software Foundation.
+ Copyright (C) 2000, 2002, 2003 Free Software Foundation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
file and use fchown on the resulting descriptor. */
int fd = open (file, O_RDONLY | O_NONBLOCK | O_NOCTTY);
fail = (fd == -1 ? 1 : fchown (fd, new_uid, new_gid));
+ if (fd != -1)
+ close (fd);
}
else
{