Blame SOURCES/nfs-utils-1.3.0-start-statd-root.patch

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