libpwdgrp/pwd_grp.c: set opened /etc/{passwd,group,shadow} fds CLOEXEC
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 6 Jan 2012 15:23:42 +0000 (16:23 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 6 Jan 2012 15:23:42 +0000 (16:23 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libpwdgrp/pwd_grp.c

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