libpwdgrp/pwd_grp.c: set opened /etc/{passwd,group,shadow} fds CLOEXEC

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2012-01-06 16:23:42 +01:00
parent 6b64a26976
commit 2e55404bcf

View File

@ -441,6 +441,7 @@ int getpwent_r(struct passwd *__restrict resultbuf,
rv = errno; rv = errno;
goto ERR; goto ERR;
} }
close_on_exec_on(fileno(pwf));
} }
rv = bb__pgsreader(bb__parsepwent, resultbuf, buffer, buflen, pwf); rv = bb__pgsreader(bb__parsepwent, resultbuf, buffer, buflen, pwf);
@ -488,6 +489,7 @@ int getgrent_r(struct group *__restrict resultbuf,
rv = errno; rv = errno;
goto ERR; goto ERR;
} }
close_on_exec_on(fileno(grf));
} }
rv = bb__pgsreader(bb__parsegrent, resultbuf, buffer, buflen, grf); rv = bb__pgsreader(bb__parsegrent, resultbuf, buffer, buflen, grf);
@ -536,6 +538,7 @@ int getspent_r(struct spwd *resultbuf, char *buffer,
rv = errno; rv = errno;
goto ERR; goto ERR;
} }
close_on_exec_on(fileno(spf));
} }
rv = bb__pgsreader(bb__parsespent, resultbuf, buffer, buflen, spf); rv = bb__pgsreader(bb__parsespent, resultbuf, buffer, buflen, spf);