Blame SOURCES/nfs-utils-1.3.0-start-statd-root.patch
|
|
851484 |
diff --git a/utils/mount/network.c b/utils/mount/network.c
|
|
|
851484 |
index 4f8c15c..515249b 100644
|
|
|
851484 |
--- a/utils/mount/network.c
|
|
|
851484 |
+++ b/utils/mount/network.c
|
|
|
851484 |
@@ -796,6 +796,8 @@ int start_statd(void)
|
|
|
851484 |
if (stat(START_STATD, &stb) == 0) {
|
|
|
851484 |
if (S_ISREG(stb.st_mode) && (stb.st_mode & S_IXUSR)) {
|
|
|
851484 |
int cnt = STATD_TIMEOUT * 10;
|
|
|
851484 |
+ int status = 0;
|
|
|
851484 |
+ char * const envp[1] = { NULL };
|
|
|
851484 |
const struct timespec ts = {
|
|
|
851484 |
.tv_sec = 0,
|
|
|
851484 |
.tv_nsec = 100000000,
|
|
|
851484 |
@@ -803,14 +805,19 @@ int start_statd(void)
|
|
|
851484 |
pid_t pid = fork();
|
|
|
851484 |
switch (pid) {
|
|
|
851484 |
case 0: /* child */
|
|
|
851484 |
- execl(START_STATD, START_STATD, NULL);
|
|
|
851484 |
+ setgid(0);
|
|
|
851484 |
+ setuid(0);
|
|
|
851484 |
+ execle(START_STATD, START_STATD, NULL, envp);
|
|
|
851484 |
exit(1);
|
|
|
851484 |
case -1: /* error */
|
|
|
851484 |
nfs_error(_("%s: fork failed: %s"),
|
|
|
851484 |
progname, strerror(errno));
|
|
|
851484 |
break;
|
|
|
851484 |
default: /* parent */
|
|
|
851484 |
- waitpid(pid, NULL,0);
|
|
|
851484 |
+ if (waitpid(pid, &status,0) == pid &&
|
|
|
851484 |
+ status == 0)
|
|
|
851484 |
+ /* assume it worked */
|
|
|
851484 |
+ return 1;
|
|
|
851484 |
break;
|
|
|
851484 |
}
|
|
|
851484 |
while (1) {
|