Kaynağa Gözat

s-s-d: Fix signed vs unsigned warning when comparing to getuid and getgid

Guillem Jover 18 yıl önce
ebeveyn
işleme
ca4146598e
2 değiştirilmiş dosya ile 8 ekleme ve 2 silme
  1. 5 0
      ChangeLog
  2. 3 2
      utils/start-stop-daemon.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+2008-01-21  Guillem Jover  <guillem@debian.org>
+
+	* utils/start-stop-daemon.c (main): Cast runas_uid and runas_gid to
+	uid_t and gid_t when comparing to getuid() and getgid().
+
 2008-01-21  Guillem Jover  <guillem@debian.org>
 
 	* configure.ac (AC_CHECK_FUNCS): Merge arguments from both macro

+ 3 - 2
utils/start-stop-daemon.c

@@ -1413,11 +1413,12 @@ main(int argc, char **argv)
 	if (chdir(changedir) < 0)
 		fatal("Unable to chdir() to %s", changedir);
 
-	if (changeuser != NULL && getuid() != runas_uid) {
+	if (changeuser != NULL && getuid() != (uid_t)runas_uid) {
 		if (setuid(runas_uid))
 			fatal("Unable to set uid to %s", changeuser);
 	}
-	if (changegroup != NULL && *changegroup != '\0' && getgid() != runas_gid) {
+	if (changegroup != NULL && *changegroup != '\0' &&
+	    getgid() != (gid_t)runas_gid) {
 		if (!gid_in_current_groups(runas_gid))
 			if (initgroups(changeuser, runas_gid))
 				fatal("Unable to set initgroups() with gid %d",