]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: address syntax-check issues in recent commit
authorPádraig Brady <P@draigBrady.com>
Mon, 7 Mar 2022 22:39:32 +0000 (22:39 +0000)
committerPádraig Brady <P@draigBrady.com>
Mon, 7 Mar 2022 23:33:25 +0000 (23:33 +0000)
* cfg.mk (sc_die_EXIT_FAILURE): Generalize to match any EXIT_ define,
and also relax to ignore error() usage with ternary operator.
* src/chroot.c (main): Use () to avoid the sc_error_quotes check.

cfg.mk
src/chroot.c

diff --git a/cfg.mk b/cfg.mk
index 90066f19a1043c849f939ed5bf210959831f1e4a..f62801ebd4cec5b3dad1aa300dd69a8fe62a61b4 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -192,7 +192,7 @@ sc_prohibit_quotes_notation:
 # Files in src/ should quote all strings in error() output, so that
 # unexpected input chars like \r etc. don't corrupt the error.
 # In edge cases this can be avoided by putting the format string
-# on a separate line to the following arguments.
+# on a separate line to the arguments, or the arguments in parenthesis.
 sc_error_quotes:
        @cd $(srcdir)/src && GIT_PAGER= git grep -n 'error *(.*%s.*, [^(]*);$$'\
          *.c | grep -v ', q' \
@@ -236,7 +236,7 @@ sc_error_shell_always_quotes:
 # to the compiler that it doesn't return.
 sc_die_EXIT_FAILURE:
        @cd $(srcdir)/src && GIT_PAGER= git grep -E \
-           'error \(.*_(FAILURE|INVALID)' \
+           'error \([^?]*EXIT_' \
          && { echo '$(ME): '"Use die() instead of error" 1>&2; \
               exit 1; }  \
          || :
index be9601304252e617311d1452bef1516c93d6e007..983940400648b6ac3ec729dfb3b06225923c751f 100644 (file)
@@ -358,7 +358,7 @@ main (int argc, char **argv)
       char const *err = parse_user_spec_warn (userspec, &uid, &gid,
                                               NULL, NULL, &warn);
       if (err)
-        error (warn ? 0 : EXIT_CANCELED, 0, "%s", err);
+        error (warn ? 0 : EXIT_CANCELED, 0, "%s", (err));
     }
 
   /* If no gid is supplied or looked up, do so now.