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

Denys Vlasenko vda.linux at googlemail.com
Fri Jan 6 15:23:42 UTC 2012


commit: http://git.busybox.net/busybox/commit/?id=2e55404bcf76f05193803b3d35359c6024f2a5f8
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libpwdgrp/pwd_grp.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c
index 2eb9d9d..23abdbe 100644
--- a/libpwdgrp/pwd_grp.c
+++ b/libpwdgrp/pwd_grp.c
@@ -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);


More information about the busybox-cvs mailing list