Procházet zdrojové kódy

dpkg-statoverride: Fix error messages on invalid uid/git/mode syntax errors

When parsing command-line arguments we should not say that the error
comes from the statoverride file.
Guillem Jover před 11 roky
rodič
revize
1dc1c04ca8
2 změnil soubory, kde provedl 5 přidání a 3 odebrání
  1. 2 0
      debian/changelog
  2. 3 3
      src/statdb.c

+ 2 - 0
debian/changelog

@@ -195,6 +195,8 @@ dpkg (1.18.0) UNRELEASED; urgency=low
       unbalanced `' pair) all over the place.
     - Use syserr() instead of an ad-hoc error message in dpkg-scansources.
     - Say substvars instead of varlist in dpkg-shlibdeps error messages.
+    - Fix error messages on invalid uid/git/mode command-line syntax errors
+      in dpkg-statoverride, to not say they are from the statoverride file.
 
   [ Raphaël Hertzog ]
   * Drop myself from Uploaders.

+ 3 - 3
src/statdb.c

@@ -56,7 +56,7 @@ statdb_parse_uid(const char *str)
 		errno = 0;
 		value = strtol(str + 1, &endptr, 10);
 		if (str + 1 == endptr || *endptr || value < 0 || errno != 0)
-			ohshit(_("syntax error: invalid uid in statoverride file"));
+			ohshit(_("invalid statoverride uid %s"), str);
 		uid = (uid_t)value;
 	} else {
 		struct passwd *pw = getpwnam(str);
@@ -82,7 +82,7 @@ statdb_parse_gid(const char *str)
 		errno = 0;
 		value = strtol(str + 1, &endptr, 10);
 		if (str + 1 == endptr || *endptr || value < 0 || errno != 0)
-			ohshit(_("syntax error: invalid gid in statoverride file"));
+			ohshit(_("invalid statoverride gid %s"), str);
 		gid = (gid_t)value;
 	} else {
 		struct group *gr = getgrnam(str);
@@ -104,7 +104,7 @@ statdb_parse_mode(const char *str)
 
 	mode = strtol(str, &endptr, 8);
 	if (str == endptr || *endptr || mode < 0 || mode > 07777)
-		ohshit(_("syntax error: invalid mode in statoverride file"));
+		ohshit(_("invalid statoverride mode %s"), str);
 
 	return (mode_t)mode;
 }