Skip to content

Conversation

@alejandro-colomar
Copy link
Collaborator

@alejandro-colomar alejandro-colomar commented Jul 13, 2025

This allows compacting a lot of code. It also makes it easier to discern lines that print to actual files, from those that print to stderr/stdout.

Queued after #1375 .


Revisions:

v2
$ git range-diff f6e676334455^..gh/eprintf shadow/master..eprintf 
1:  f6e67633 ! 1:  302aae32 lib/io/fprintf/: eprintf(): Add function to print to stderr
    @@ lib/io/fprintf/eprintf.c (new)
     +// SPDX-License-Identifier: BSD-3-Clause
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "io/fprintf/eprintf.h"
     +
    @@ lib/io/fprintf/eprintf.h (new)
     +#define SHADOW_INCLUDE_LIB_IO_FPRINTF_EPRINTF_H_
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include <stdarg.h>
     +#include <stdio.h>
2:  1c1568e1 = 2:  a3ed1da0 lib/, src/: Use eprintf() instead of its pattern
3:  be83d1b4 < -:  -------- src/vipw.c: usage(): Print everything to the same stream
4:  c3af808a < -:  -------- lib/, src/: Use printf(3) instead of its pattern
v2b
  • Rebase
$ git rd 
1:  302aae32 = 1:  da4c7959 lib/io/fprintf/: eprintf(): Add function to print to stderr
2:  a3ed1da0 ! 2:  13a80305 lib/, src/: Use eprintf() instead of its pattern
    @@ src/login.c: int main (int argc, char **argv)
                exit (0);
        } else if (child != 0) {
     @@ src/login.c: int main (int argc, char **argv)
    -   if (getppid() == 1) {
    +   if (1 == initial_pid) {
                setsid();
                if (ioctl(0, TIOCSCTTY, 1) != 0) {
     -                  fprintf (stderr, _("TIOCSCTTY failed on %s"), tty);
v3
  • Add and use strerrno(). This compacts some lines further.
$ git rd
1:  da4c7959 = 1:  da4c7959 lib/io/fprintf/: eprintf(): Add function to print to stderr
2:  13a80305 = 2:  13a80305 lib/, src/: Use eprintf() instead of its pattern
-:  -------- > 3:  e1cddf24 lib/string/: strerrno(): Add function
-:  -------- > 4:  767c2377 lib/, src/: Use strerrno() instead of its pattern
v4
  • Fix definition of SYSLOG() to remove the weird double parentheses.
  • Fix non-matching parentheses in SYSLOG() call.
$ git rd 
1:  da4c7959 = 1:  da4c7959 lib/io/fprintf/: eprintf(): Add function to print to stderr
2:  13a80305 = 2:  13a80305 lib/, src/: Use eprintf() instead of its pattern
3:  e1cddf24 = 3:  e1cddf24 lib/string/: strerrno(): Add function
4:  767c2377 = 4:  767c2377 lib/, src/: Use strerrno() instead of its pattern
-:  -------- > 5:  7e6bef2e src/su.c: Fix incorrect (non-matching) parentheses
-:  -------- > 6:  a9900489 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
v5
  • Add moar wrappers, fix moar bugs, make code moar readable.
$ git rd 
 1:  da4c7959 =  1:  da4c7959 lib/io/fprintf/: eprintf(): Add function to print to stderr
 2:  13a80305 =  2:  13a80305 lib/, src/: Use eprintf() instead of its pattern
 3:  e1cddf24 =  3:  e1cddf24 lib/string/: strerrno(): Add function
 4:  767c2377 =  4:  767c2377 lib/, src/: Use strerrno() instead of its pattern
 5:  7e6bef2e =  5:  7e6bef2e src/su.c: Fix incorrect (non-matching) parentheses
 6:  a9900489 =  6:  a9900489 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
 -:  -------- >  7:  ca6382ba lib/: Move <syslog.h> wrappers to "io/syslog.h"
 -:  -------- >  8:  eb3b2517 lib/io/: syslog_c(): Implement SYSLOG() with a helper function
 -:  -------- >  9:  82cf1bd0 lib/io/syslog.h: Call setlocale(3) and free(3) unconditionally
 -:  -------- > 10:  67826ff5 lib/io/fprintf/: [v]fprinte(): Add function
 -:  -------- > 11:  53eaccf5 lib/io/fprintf/: [v]eprinte(): Add function
 -:  -------- > 12:  a7e0a585 lib/, src/: Use eprinte() instead of its pattern
 -:  -------- > 13:  ec4bcad1 lib/: Use [v]fprinte() instead of its pattern
 -:  -------- > 14:  15c8269f lib/io/syslog.h: SYSLOGE(): Add macro
 -:  -------- > 15:  73f63bd4 src/userdel.c: Fix error message
 -:  -------- > 16:  2c45897a lib/, src/: Use SYSLOGE() instead of its pattern
v5b
  • tfix
$ git rd 
 1:  da4c7959 =  1:  da4c7959 lib/io/fprintf/: eprintf(): Add function to print to stderr
 2:  13a80305 =  2:  13a80305 lib/, src/: Use eprintf() instead of its pattern
 3:  e1cddf24 =  3:  e1cddf24 lib/string/: strerrno(): Add function
 4:  767c2377 =  4:  767c2377 lib/, src/: Use strerrno() instead of its pattern
 5:  7e6bef2e =  5:  7e6bef2e src/su.c: Fix incorrect (non-matching) parentheses
 6:  a9900489 =  6:  a9900489 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
 7:  ca6382ba =  7:  ca6382ba lib/: Move <syslog.h> wrappers to "io/syslog.h"
 8:  eb3b2517 =  8:  eb3b2517 lib/io/: syslog_c(): Implement SYSLOG() with a helper function
 9:  82cf1bd0 =  9:  82cf1bd0 lib/io/syslog.h: Call setlocale(3) and free(3) unconditionally
10:  67826ff5 ! 10:  9ad98eef lib/io/fprintf/: [v]fprinte(): Add function
    @@ lib/io/fprintf/fprinte.h (new)
     +#include "attr.h"
     +
     +
    -+format_attr(printf, 2, 2)
    ++format_attr(printf, 2, 3)
     +inline int fprinte(FILE *restrict stream, const char *restrict fmt, ...);
     +format_attr(printf, 2, 0)
     +inline int vfprinte(FILE *restrict stream, const char *restrict fmt, va_list ap);
11:  53eaccf5 = 11:  ff79b1d7 lib/io/fprintf/: [v]eprinte(): Add function
12:  a7e0a585 = 12:  79ce27b7 lib/, src/: Use eprinte() instead of its pattern
13:  ec4bcad1 = 13:  adf040bd lib/: Use [v]fprinte() instead of its pattern
14:  15c8269f = 14:  3c56b00e lib/io/syslog.h: SYSLOGE(): Add macro
15:  73f63bd4 = 15:  215bfe62 src/userdel.c: Fix error message
16:  2c45897a = 16:  2e8be431 lib/, src/: Use SYSLOGE() instead of its pattern
v6
  • SYSLOG_C() must be a macro. It does some interesting magic!
$ git rd 
 1:  da4c7959 =  1:  da4c7959 lib/io/fprintf/: eprintf(): Add function to print to stderr
 2:  13a80305 =  2:  13a80305 lib/, src/: Use eprintf() instead of its pattern
 3:  e1cddf24 =  3:  e1cddf24 lib/string/: strerrno(): Add function
 4:  767c2377 =  4:  767c2377 lib/, src/: Use strerrno() instead of its pattern
 5:  7e6bef2e =  5:  7e6bef2e src/su.c: Fix incorrect (non-matching) parentheses
 6:  a9900489 =  6:  a9900489 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
 7:  ca6382ba =  7:  ca6382ba lib/: Move <syslog.h> wrappers to "io/syslog.h"
 8:  eb3b2517 !  8:  d9cb90ca lib/io/: syslog_c(): Implement SYSLOG() with a helper function
    @@ Metadata
     Author: Alejandro Colomar <[email protected]>
     
      ## Commit message ##
    -    lib/io/: syslog_c(): Implement SYSLOG() with a helper function
    +    lib/io/syslog.h: SYSLOG_C(): Split code to helper macro
    +
    +    The name of this macro makes it more evident what it does.  It's a
    +    C-locale version of syslog(3).  We need to implement it as a macro
    +    so that arguments such as strerror(3) are evaluated after setting
    +    the C locale.  This would be impossible with a function.
     
         Signed-off-by: Alejandro Colomar <[email protected]>
     
    - ## lib/io/syslog.c ##
    -@@
    - #include "config.h"
    - 
    - #include "io/syslog.h"
    -+
    -+#include <stdarg.h>
    -+
    -+
    -+extern inline void syslog_c(int priority, const char *restrict fmt, ...);
    -+extern inline void vsyslog_c(int priority, const char *restrict fmt, va_list ap);
    -
      ## lib/io/syslog.h ##
    -@@
    - #include "config.h"
    - 
    - #include <locale.h>
    -+#include <stdarg.h>
    - #include <stddef.h>
    - #include <stdlib.h>
    - #include <string.h>
     @@
      #define LOG_AUTHPRIV LOG_AUTH
      #endif
    @@ lib/io/syslog.h
     -          }                                                       \
     -  } while (false)
     -#else                             /* !ENABLE_NLS */
    -+#define SYSLOG(...)  syslog_c(__VA_ARGS__)
    ++#define SYSLOG(...)  SYSLOG_C(__VA_ARGS__)
     +#else
      #define SYSLOG(...)  syslog(__VA_ARGS__)
     -#endif                            /* !ENABLE_NLS */
    @@ lib/io/syslog.h
      #define OPENLOG(progname) openlog(progname, SYSLOG_OPTIONS, SYSLOG_FACILITY)
      
      
    -+inline void syslog_c(int priority, const char *restrict fmt, ...);
    -+inline void vsyslog_c(int priority, const char *restrict fmt, va_list ap);
    -+
    -+
     +// system log C-locale
    -+inline void
    -+syslog_c(int priority, const char *restrict fmt, ...)
    -+{
    -+  va_list  ap;
    -+
    -+  va_start(ap, fmt);
    -+  vsyslog_c(priority, fmt, ap);
    -+  va_end(ap);
    -+}
    -+
    -+
    -+// va_list system log C-locale
    -+inline void
    -+vsyslog_c(int priority, const char *restrict fmt, va_list ap)
    -+{
    -+  char *old_locale;
    -+  char *saved_locale;
    -+
    -+  old_locale = setlocale(LC_ALL, NULL);
    -+  saved_locale = NULL;
    -+
    -+  if (NULL != old_locale)
    -+          saved_locale = strdup(old_locale);
    -+
    -+  if (NULL != saved_locale)
    -+          setlocale(LC_ALL, "C");
    -+
    -+  vsyslog(priority, fmt, ap);
    -+
    -+  if (NULL != saved_locale) {
    -+          setlocale(LC_ALL, saved_locale);
    -+          free(saved_locale);
    -+  }
    -+}
    ++#define SYSLOG_C(...)  do                                             \
    ++{                                                                     \
    ++  char  *old_locale;                                            \
    ++  char  *saved_locale;                                          \
    ++                                                                      \
    ++  old_locale = setlocale(LC_ALL, NULL);                         \
    ++  saved_locale = NULL;                                          \
    ++                                                                      \
    ++  if (NULL != old_locale)                                       \
    ++          saved_locale = strdup(old_locale);                    \
    ++                                                                      \
    ++  if (NULL != saved_locale) {                                   \
    ++          setlocale(LC_ALL, "C");                               \
    ++                                                                      \
    ++  syslog(__VA_ARGS__);                                          \
    ++  if (NULL != saved_locale) {                                   \
    ++          setlocale(LC_ALL, saved_locale);                      \
    ++          free(saved_locale);                                   \
    ++  }                                                             \
    ++} while (0)
     +
     +
      #endif  // include guard
 9:  82cf1bd0 <  -:  -------- lib/io/syslog.h: Call setlocale(3) and free(3) unconditionally
 -:  -------- >  9:  1f0531b1 lib/io/syslog.h: Rename local variable
 -:  -------- > 10:  41bd7c81 lib/io/syslog.h: SYSLOG_C(): Use a single local variable
 -:  -------- > 11:  163ebeea lib/io/syslog.h: SYSLOG_C(): Call setlocale(3) and free(3) unconditionally
10:  9ad98eef = 12:  95463ee9 lib/io/fprintf/: [v]fprinte(): Add function
11:  ff79b1d7 = 13:  1c37648a lib/io/fprintf/: [v]eprinte(): Add function
12:  79ce27b7 = 14:  d45e1fee lib/, src/: Use eprinte() instead of its pattern
13:  adf040bd = 15:  cfecd5ca lib/: Use [v]fprinte() instead of its pattern
14:  3c56b00e ! 16:  3caa45d7 lib/io/syslog.h: SYSLOGE(): Add macro
    @@ lib/io/syslog.h
     +)
     +
     +
    - inline void syslog_c(int priority, const char *restrict fmt, ...);
    - inline void vsyslog_c(int priority, const char *restrict fmt, va_list ap);
    - 
    + // system log C-locale
    + #define SYSLOG_C(...)  do                                             \
    + {                                                                     \
15:  215bfe62 = 17:  eaed086d src/userdel.c: Fix error message
16:  2e8be431 = 18:  5b44ec25 lib/, src/: Use SYSLOGE() instead of its pattern
v6b
  • fix braces
$ git rd 
 1:  da4c7959 =  1:  da4c7959 lib/io/fprintf/: eprintf(): Add function to print to stderr
 2:  13a80305 =  2:  13a80305 lib/, src/: Use eprintf() instead of its pattern
 3:  e1cddf24 =  3:  e1cddf24 lib/string/: strerrno(): Add function
 4:  767c2377 =  4:  767c2377 lib/, src/: Use strerrno() instead of its pattern
 5:  7e6bef2e =  5:  7e6bef2e src/su.c: Fix incorrect (non-matching) parentheses
 6:  a9900489 =  6:  a9900489 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
 7:  ca6382ba =  7:  ca6382ba lib/: Move <syslog.h> wrappers to "io/syslog.h"
 8:  d9cb90ca !  8:  73336b3f lib/io/syslog.h: SYSLOG_C(): Split code to helper macro
    @@ lib/io/syslog.h
     +  if (NULL != old_locale)                                       \
     +          saved_locale = strdup(old_locale);                    \
     +                                                                      \
    -+  if (NULL != saved_locale) {                                   \
    ++  if (NULL != saved_locale)                                     \
     +          setlocale(LC_ALL, "C");                               \
     +                                                                      \
     +  syslog(__VA_ARGS__);                                          \
 9:  1f0531b1 !  9:  063966cc lib/io/syslog.h: Rename local variable
    @@ lib/io/syslog.h
     +  if (NULL != l_)                                               \
     +          saved_locale = strdup(l_);                            \
                                                                            \
    -   if (NULL != saved_locale) {                                   \
    +   if (NULL != saved_locale)                                     \
                setlocale(LC_ALL, "C");                               \
10:  41bd7c81 ! 10:  ab24ab95 lib/io/syslog.h: SYSLOG_C(): Use a single local variable
    @@ lib/io/syslog.h
     -          saved_locale = strdup(l_);                            \
     +          l_ = strdup(l_);                                      \
                                                                            \
    --  if (NULL != saved_locale) {                                   \
    -+  if (NULL != l_) {                                             \
    +-  if (NULL != saved_locale)                                     \
    ++  if (NULL != l_)                                               \
                setlocale(LC_ALL, "C");                               \
                                                                            \
        syslog(__VA_ARGS__);                                          \
11:  163ebeea = 11:  07f77ecf lib/io/syslog.h: SYSLOG_C(): Call setlocale(3) and free(3) unconditionally
12:  95463ee9 = 12:  4d3b887d lib/io/fprintf/: [v]fprinte(): Add function
13:  1c37648a = 13:  e2e2c4fd lib/io/fprintf/: [v]eprinte(): Add function
14:  d45e1fee = 14:  058f311a lib/, src/: Use eprinte() instead of its pattern
15:  cfecd5ca = 15:  3b1c3231 lib/: Use [v]fprinte() instead of its pattern
16:  3caa45d7 = 16:  955ab8bf lib/io/syslog.h: SYSLOGE(): Add macro
17:  eaed086d = 17:  7be1c698 src/userdel.c: Fix error message
18:  5b44ec25 = 18:  2e1ee543 lib/, src/: Use SYSLOGE() instead of its pattern
v6c
  • Use do-while(0) to implement SYSLOGE()
$ git rd 
 1:  da4c7959 =  1:  da4c7959 lib/io/fprintf/: eprintf(): Add function to print to stderr
 2:  13a80305 =  2:  13a80305 lib/, src/: Use eprintf() instead of its pattern
 3:  e1cddf24 =  3:  e1cddf24 lib/string/: strerrno(): Add function
 4:  767c2377 =  4:  767c2377 lib/, src/: Use strerrno() instead of its pattern
 5:  7e6bef2e =  5:  7e6bef2e src/su.c: Fix incorrect (non-matching) parentheses
 6:  a9900489 =  6:  a9900489 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
 7:  ca6382ba =  7:  ca6382ba lib/: Move <syslog.h> wrappers to "io/syslog.h"
 8:  73336b3f =  8:  73336b3f lib/io/syslog.h: SYSLOG_C(): Split code to helper macro
 9:  063966cc =  9:  063966cc lib/io/syslog.h: Rename local variable
10:  ab24ab95 = 10:  ab24ab95 lib/io/syslog.h: SYSLOG_C(): Use a single local variable
11:  07f77ecf = 11:  07f77ecf lib/io/syslog.h: SYSLOG_C(): Call setlocale(3) and free(3) unconditionally
12:  4d3b887d = 12:  4d3b887d lib/io/fprintf/: [v]fprinte(): Add function
13:  e2e2c4fd = 13:  e2e2c4fd lib/io/fprintf/: [v]eprinte(): Add function
14:  058f311a = 14:  058f311a lib/, src/: Use eprinte() instead of its pattern
15:  3b1c3231 = 15:  3b1c3231 lib/: Use [v]fprinte() instead of its pattern
16:  955ab8bf ! 16:  47cf544a lib/io/syslog.h: SYSLOGE(): Add macro
    @@ lib/io/syslog.h
      
      
     +// system log errno
    -+#define SYSLOGE(prio, fmt, ...)                                       \
    -+(                                                                     \
    ++#define SYSLOGE(prio, fmt, ...)  do                                   \
    ++{                                                                     \
     +  SYSLOG(prio, "" fmt ": %s" __VA_OPT__(,) __VA_ARGS__, strerrno()) \
    -+)
    ++} while (0)
     +
     +
      // system log C-locale
17:  7be1c698 = 17:  9faad6e1 src/userdel.c: Fix error message
18:  2e1ee543 = 18:  e0290fcb lib/, src/: Use SYSLOGE() instead of its pattern
v6d
  • Fix semicolons.
$ git rd
 1:  da4c7959 =  1:  da4c7959 lib/io/fprintf/: eprintf(): Add function to print to stderr
 2:  13a80305 =  2:  13a80305 lib/, src/: Use eprintf() instead of its pattern
 3:  e1cddf24 =  3:  e1cddf24 lib/string/: strerrno(): Add function
 4:  767c2377 =  4:  767c2377 lib/, src/: Use strerrno() instead of its pattern
 5:  7e6bef2e =  5:  7e6bef2e src/su.c: Fix incorrect (non-matching) parentheses
 6:  a9900489 =  6:  a9900489 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
 7:  ca6382ba =  7:  ca6382ba lib/: Move <syslog.h> wrappers to "io/syslog.h"
 8:  73336b3f =  8:  73336b3f lib/io/syslog.h: SYSLOG_C(): Split code to helper macro
 9:  063966cc =  9:  063966cc lib/io/syslog.h: Rename local variable
10:  ab24ab95 = 10:  ab24ab95 lib/io/syslog.h: SYSLOG_C(): Use a single local variable
11:  07f77ecf = 11:  07f77ecf lib/io/syslog.h: SYSLOG_C(): Call setlocale(3) and free(3) unconditionally
12:  4d3b887d = 12:  4d3b887d lib/io/fprintf/: [v]fprinte(): Add function
13:  e2e2c4fd = 13:  e2e2c4fd lib/io/fprintf/: [v]eprinte(): Add function
14:  058f311a = 14:  058f311a lib/, src/: Use eprinte() instead of its pattern
15:  3b1c3231 = 15:  3b1c3231 lib/: Use [v]fprinte() instead of its pattern
16:  47cf544a ! 16:  d94ded03 lib/io/syslog.h: SYSLOGE(): Add macro
    @@ lib/io/syslog.h
     +// system log errno
     +#define SYSLOGE(prio, fmt, ...)  do                                   \
     +{                                                                     \
    -+  SYSLOG(prio, "" fmt ": %s" __VA_OPT__(,) __VA_ARGS__, strerrno()) \
    ++  SYSLOG(prio, "" fmt ": %s" __VA_OPT__(,) __VA_ARGS__, strerrno()); \
     +} while (0)
     +
     +
17:  9faad6e1 = 17:  a16468a1 src/userdel.c: Fix error message
18:  e0290fcb = 18:  97d74781 lib/, src/: Use SYSLOGE() instead of its pattern
v6e
  • Add missing includes
$ git rd 
 -:  -------- >  1:  453bb132 lib/getdef.h: Add missing includes
 1:  da4c7959 =  2:  1aa42283 lib/io/fprintf/: eprintf(): Add function to print to stderr
 2:  13a80305 =  3:  e0f12df3 lib/, src/: Use eprintf() instead of its pattern
 3:  e1cddf24 =  4:  9478a434 lib/string/: strerrno(): Add function
 4:  767c2377 =  5:  7d03b42e lib/, src/: Use strerrno() instead of its pattern
 5:  7e6bef2e =  6:  869d2b44 src/su.c: Fix incorrect (non-matching) parentheses
 6:  a9900489 =  7:  96049602 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
 7:  ca6382ba =  8:  e542800a lib/: Move <syslog.h> wrappers to "io/syslog.h"
 8:  73336b3f =  9:  59a7bd7a lib/io/syslog.h: SYSLOG_C(): Split code to helper macro
 9:  063966cc = 10:  df5826c0 lib/io/syslog.h: Rename local variable
10:  ab24ab95 = 11:  7508615d lib/io/syslog.h: SYSLOG_C(): Use a single local variable
11:  07f77ecf = 12:  20a4f244 lib/io/syslog.h: SYSLOG_C(): Call setlocale(3) and free(3) unconditionally
12:  4d3b887d = 13:  7b2ce1f1 lib/io/fprintf/: [v]fprinte(): Add function
13:  e2e2c4fd = 14:  5b13bfba lib/io/fprintf/: [v]eprinte(): Add function
14:  058f311a = 15:  da1c2aac lib/, src/: Use eprinte() instead of its pattern
15:  3b1c3231 = 16:  1004d7e8 lib/: Use [v]fprinte() instead of its pattern
16:  d94ded03 = 17:  fa4d663d lib/io/syslog.h: SYSLOGE(): Add macro
17:  a16468a1 = 18:  42ff49da src/userdel.c: Fix error message
18:  97d74781 = 19:  68dfb3ae lib/, src/: Use SYSLOGE() instead of its pattern
v6f
  • Rebase
$ git rd 
 1:  453bb132 =  1:  0ac2e68c lib/getdef.h: Add missing includes
 2:  1aa42283 =  2:  acc8238c lib/io/fprintf/: eprintf(): Add function to print to stderr
 3:  e0f12df3 !  3:  4ebb63c2 lib/, src/: Use eprintf() instead of its pattern
    @@ src/chfn.c: int main (int argc, char **argv)
                        SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
                                 (unsigned long) getuid ()));
     @@ src/chfn.c: int main (int argc, char **argv)
    -    */
    -   if ((strlen (fullnm) + strlen (roomno) + strlen (workph) +
    -        strlen (homeph) + strlen (slop)) > (unsigned int) 80) {
    +           p = stpeprintf(p, e, ",%s", slop);
    + 
    +   if (p == e || p == NULL) {
     -          fprintf (stderr, _("%s: fields too long\n"), Prog);
     +          eprintf(_("%s: fields too long\n"), Prog);
                fail_exit (E_NOPERM);
        }
    -   SNPRINTF(new_gecos, "%s,%s,%s,%s%s%s",
    + 
     
      ## src/chgpasswd.c ##
     @@
 4:  9478a434 =  4:  2a615806 lib/string/: strerrno(): Add function
 5:  7d03b42e =  5:  fae8b792 lib/, src/: Use strerrno() instead of its pattern
 6:  869d2b44 =  6:  bdbe3523 src/su.c: Fix incorrect (non-matching) parentheses
 7:  96049602 =  7:  b170a21d lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
 8:  e542800a =  8:  abdabe26 lib/: Move <syslog.h> wrappers to "io/syslog.h"
 9:  59a7bd7a =  9:  feda6e03 lib/io/syslog.h: SYSLOG_C(): Split code to helper macro
10:  df5826c0 = 10:  75cd1347 lib/io/syslog.h: Rename local variable
11:  7508615d = 11:  71818a6f lib/io/syslog.h: SYSLOG_C(): Use a single local variable
12:  20a4f244 = 12:  02ce55c6 lib/io/syslog.h: SYSLOG_C(): Call setlocale(3) and free(3) unconditionally
13:  7b2ce1f1 = 13:  c77c1be8 lib/io/fprintf/: [v]fprinte(): Add function
14:  5b13bfba = 14:  3a5f8825 lib/io/fprintf/: [v]eprinte(): Add function
15:  da1c2aac = 15:  a1a173d4 lib/, src/: Use eprinte() instead of its pattern
16:  1004d7e8 = 16:  17c5083e lib/: Use [v]fprinte() instead of its pattern
17:  fa4d663d = 17:  51640f21 lib/io/syslog.h: SYSLOGE(): Add macro
18:  42ff49da = 18:  3fb3b4c8 src/userdel.c: Fix error message
19:  68dfb3ae = 19:  55cd6cbc lib/, src/: Use SYSLOGE() instead of its pattern
v6g
  • Rebase
$ git rd 
 1:  0ac2e68c =  1:  6bc39aba lib/getdef.h: Add missing includes
 2:  acc8238c =  2:  4a57daa1 lib/io/fprintf/: eprintf(): Add function to print to stderr
 3:  4ebb63c2 =  3:  e75c9ff3 lib/, src/: Use eprintf() instead of its pattern
 4:  2a615806 =  4:  a46a8a0e lib/string/: strerrno(): Add function
 5:  fae8b792 =  5:  98555258 lib/, src/: Use strerrno() instead of its pattern
 6:  bdbe3523 =  6:  ad63c9e1 src/su.c: Fix incorrect (non-matching) parentheses
 7:  b170a21d =  7:  f56b7440 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
 8:  abdabe26 =  8:  d688bdb1 lib/: Move <syslog.h> wrappers to "io/syslog.h"
 9:  feda6e03 =  9:  4b42ef08 lib/io/syslog.h: SYSLOG_C(): Split code to helper macro
10:  75cd1347 = 10:  31706a0b lib/io/syslog.h: Rename local variable
11:  71818a6f = 11:  bd960db3 lib/io/syslog.h: SYSLOG_C(): Use a single local variable
12:  02ce55c6 = 12:  5164c736 lib/io/syslog.h: SYSLOG_C(): Call setlocale(3) and free(3) unconditionally
13:  c77c1be8 = 13:  c3e54019 lib/io/fprintf/: [v]fprinte(): Add function
14:  3a5f8825 = 14:  854399af lib/io/fprintf/: [v]eprinte(): Add function
15:  a1a173d4 = 15:  9d17e83b lib/, src/: Use eprinte() instead of its pattern
16:  17c5083e = 16:  f773e997 lib/: Use [v]fprinte() instead of its pattern
17:  51640f21 = 17:  93b6a5fc lib/io/syslog.h: SYSLOGE(): Add macro
18:  3fb3b4c8 = 18:  dc366523 src/userdel.c: Fix error message
19:  55cd6cbc = 19:  0a20d7bf lib/, src/: Use SYSLOGE() instead of its pattern
v7
  • Rebase
$ git rd 
 1:  6bc39aba =  1:  4c7cdd81 lib/getdef.h: Add missing includes
 2:  4a57daa1 =  2:  c5f7d1ba lib/io/fprintf/: eprintf(): Add function to print to stderr
 3:  e75c9ff3 !  3:  e9de5767 lib/, src/: Use eprintf() instead of its pattern
    @@ src/chpasswd.c: static void close_files (void)
                /* continue */
        }
     @@ src/chpasswd.c: int main (int argc, char **argv)
    -                                   }
    +                                           break;
                                }
      
     -                          fprintf (stderr,
    @@ src/lastlog.c: int main (int argc, char **argv)
     -          fprintf (stderr,
     -                   _("%s: Cannot get the size of %s: %s\n"),
     +          eprintf(_("%s: Cannot get the size of %s: %s\n"),
    -                    Prog, LASTLOG_FILE, strerror (errno));
    +                    Prog, _PATH_LASTLOG, strerror(errno));
                exit (EXIT_FAILURE);
        }
     
    @@ src/newgidmap.c: int main(int argc, char **argv)
     @@ src/newgidmap.c: int main(int argc, char **argv)
        }
      
    -   if (!sub_gid_open(O_RDONLY)) {
    +   if (want_subgid_file() && !sub_gid_open(O_RDONLY)) {
     -          fprintf (stderr,
     -                   _("%s: cannot open %s: %s\n"),
     +          eprintf(_("%s: cannot open %s: %s\n"),
    @@ src/newuidmap.c: int main(int argc, char **argv)
     @@ src/newuidmap.c: int main(int argc, char **argv)
        }
      
    -   if (!sub_uid_open(O_RDONLY)) {
    +   if (want_subuid_file() && !sub_uid_open(O_RDONLY)) {
     -          fprintf (stderr,
     -                   _("%s: cannot open %s: %s\n"),
     +          eprintf(_("%s: cannot open %s: %s\n"),
    @@ src/su.c: save_caller_context(void)
     @@ src/su.c: int main (int argc, char **argv)
        ret = pam_start (Prog, name, &conv, &pamh);
        if (PAM_SUCCESS != ret) {
    -           SYSLOG ((LOG_ERR, "pam_start: error %d", ret);
    --          fprintf (stderr,
    --                   _("%s: pam_start: error %d\n"),
    --                   Prog, ret));
    -+          eprintf(_("%s: pam_start: error %d\n"), Prog, ret));
    +           SYSLOG((LOG_ERR, "pam_start: error %d", ret));
    +-          fprintf(stderr, _("%s: pam_start: error %d\n"), Prog, ret);
    ++          eprintf(_("%s: pam_start: error %d\n"), Prog, ret);
                exit (1);
        }
      
    @@ src/useradd.c: static void faillog_reset (uid_t uid)
        }
     @@ src/useradd.c: static void lastlog_reset (uid_t uid)
      
    -   fd = open (LASTLOG_FILE, O_RDWR);
    +   fd = open(_PATH_LASTLOG, O_RDWR);
        if (-1 == fd) {
     -          fprintf (stderr,
     -                   _("%s: failed to open the lastlog file for UID %lu: %s\n"),
    @@ src/usermod.c: static void move_home (void)
        }
      }
     @@ src/usermod.c: static void update_lastlog (void)
    -   fd = open (LASTLOG_FILE, O_RDWR);
    +   fd = open(_PATH_LASTLOG, O_RDWR);
      
        if (-1 == fd) {
     -          fprintf (stderr,
 4:  a46a8a0e =  4:  c303977c lib/string/: strerrno(): Add function
 5:  98555258 !  5:  05f95c6f lib/, src/: Use strerrno() instead of its pattern
    @@ lib/tcbfuncs.c: static shadowtcb_status mkdir_leading (const char *name, uid_t u
     +                   shadow_progname, TCB_DIR, strerrno());
                goto out_free_path;
        }
    -   while ((ind = strchr (ptr, '/'))) {
    +   while (NULL != (ind = strchr(ptr, '/'))) {
     @@ lib/tcbfuncs.c: static shadowtcb_status mkdir_leading (const char *name, uid_t uid)
                if ((mkdir (dir, 0700) != 0) && (errno != EEXIST)) {
                        fprintf (shadow_logfd,
    @@ src/lastlog.c: int main (int argc, char **argv)
        /* Get the lastlog size */
        if (fstat (fileno (lastlogfile), &statbuf) != 0) {
                eprintf(_("%s: Cannot get the size of %s: %s\n"),
    --                   Prog, LASTLOG_FILE, strerror (errno));
    -+                  Prog, LASTLOG_FILE, strerrno());
    +-                   Prog, _PATH_LASTLOG, strerror(errno));
    ++                  Prog, _PATH_LASTLOG, strerrno());
                exit (EXIT_FAILURE);
        }
      
    @@ src/newgidmap.c: int main(int argc, char **argv)
     @@ src/newgidmap.c: int main(int argc, char **argv)
        }
      
    -   if (!sub_gid_open(O_RDONLY)) {
    +   if (want_subgid_file() && !sub_gid_open(O_RDONLY)) {
     -          eprintf(_("%s: cannot open %s: %s\n"),
     -                   Prog, sub_gid_dbname (), strerror (errno));
     +          eprintf(_("%s: cannot open %s: %s\n"), Prog, sub_gid_dbname(), strerrno());
    @@ src/newuidmap.c: int main(int argc, char **argv)
      
     @@ src/newuidmap.c: int main(int argc, char **argv)
      
    -   if (!sub_uid_open(O_RDONLY)) {
    +   if (want_subuid_file() && !sub_uid_open(O_RDONLY)) {
                eprintf(_("%s: cannot open %s: %s\n"),
     -                   Prog, sub_uid_dbname (), strerror (errno));
     +                  Prog, sub_uid_dbname(), strerrno());
    @@ src/useradd.c: static void faillog_reset (uid_t uid)
        }
      }
     @@ src/useradd.c: static void lastlog_reset (uid_t uid)
    -   fd = open (LASTLOG_FILE, O_RDWR);
    +   fd = open(_PATH_LASTLOG, O_RDWR);
        if (-1 == fd) {
                eprintf(_("%s: failed to open the lastlog file for UID %lu: %s\n"),
     -                   Prog, (unsigned long) uid, strerror (errno));
 6:  ad63c9e1 <  -:  -------- src/su.c: Fix incorrect (non-matching) parentheses
 7:  f56b7440 !  6:  5a448c24 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
    @@ lib/log.c: void dolastlog (
        if (lseek (fd, offset, SEEK_SET) != offset) {
     -          SYSLOG ((LOG_WARN,
     -                   "Can't read last lastlog entry for UID %lu in %s. Entry not updated.",
    --                   (unsigned long) pw->pw_uid, LASTLOG_FILE));
    +-                   (unsigned long) pw->pw_uid, _PATH_LASTLOG));
     +          SYSLOG(LOG_WARN,
     +                 "Can't read last lastlog entry for UID %lu in %s. Entry not updated.",
    -+                 (unsigned long) pw->pw_uid, LASTLOG_FILE);
    ++                 (unsigned long) pw->pw_uid, _PATH_LASTLOG);
                (void) close (fd);
                return;
        }
    @@ lib/log.c: err_write:
      err_close:
     -  SYSLOG ((LOG_WARN,
     -           "Can't write lastlog entry for UID %lu in %s: %m",
    --           (unsigned long) pw->pw_uid, LASTLOG_FILE));
    +-           (unsigned long) pw->pw_uid, _PATH_LASTLOG));
     +  SYSLOG(LOG_WARN,
     +         "Can't write lastlog entry for UID %lu in %s: %m",
    -+         (unsigned long) pw->pw_uid, LASTLOG_FILE);
    ++         (unsigned long) pw->pw_uid, _PATH_LASTLOG);
      }
     
      ## lib/pwdcheck.c ##
 8:  d688bdb1 =  7:  89a68bba lib/: Move <syslog.h> wrappers to "io/syslog.h"
 9:  4b42ef08 =  8:  de8b9cd4 lib/io/syslog.h: SYSLOG_C(): Split code to helper macro
10:  31706a0b =  9:  5cbca3af lib/io/syslog.h: Rename local variable
11:  bd960db3 = 10:  91bbde22 lib/io/syslog.h: SYSLOG_C(): Use a single local variable
12:  5164c736 = 11:  e32447c6 lib/io/syslog.h: SYSLOG_C(): Call setlocale(3) and free(3) unconditionally
13:  c3e54019 = 12:  fa2d4762 lib/io/fprintf/: [v]fprinte(): Add function
14:  854399af = 13:  d36ed519 lib/io/fprintf/: [v]eprinte(): Add function
15:  9d17e83b ! 14:  0a0f2c23 lib/, src/: Use eprinte() instead of its pattern
    @@ src/lastlog.c: int main (int argc, char **argv)
        /* Get the lastlog size */
        if (fstat (fileno (lastlogfile), &statbuf) != 0) {
     -          eprintf(_("%s: Cannot get the size of %s: %s\n"),
    --                  Prog, LASTLOG_FILE, strerrno());
    -+          eprinte(_("%s: Cannot get the size of %s"), Prog, LASTLOG_FILE);
    +-                  Prog, _PATH_LASTLOG, strerrno());
    ++          eprinte(_("%s: Cannot get the size of %s"), Prog, _PATH_LASTLOG);
                exit (EXIT_FAILURE);
        }
      
    @@ src/newgidmap.c: int main(int argc, char **argv)
     @@ src/newgidmap.c: int main(int argc, char **argv)
        }
      
    -   if (!sub_gid_open(O_RDONLY)) {
    +   if (want_subgid_file() && !sub_gid_open(O_RDONLY)) {
     -          eprintf(_("%s: cannot open %s: %s\n"), Prog, sub_gid_dbname(), strerrno());
     +          eprinte(_("%s: cannot open %s"), Prog, sub_gid_dbname());
                return EXIT_FAILURE;
    @@ src/newuidmap.c: int main(int argc, char **argv)
     @@ src/newuidmap.c: int main(int argc, char **argv)
        }
      
    -   if (!sub_uid_open(O_RDONLY)) {
    +   if (want_subuid_file() && !sub_uid_open(O_RDONLY)) {
     -          eprintf(_("%s: cannot open %s: %s\n"),
     -                  Prog, sub_uid_dbname(), strerrno());
     +          eprinte(_("%s: cannot open %s"), Prog, sub_uid_dbname());
    @@ src/useradd.c: static void faillog_reset (uid_t uid)
      }
     @@ src/useradd.c: static void lastlog_reset (uid_t uid)
      
    -   fd = open (LASTLOG_FILE, O_RDWR);
    +   fd = open(_PATH_LASTLOG, O_RDWR);
        if (-1 == fd) {
     -          eprintf(_("%s: failed to open the lastlog file for UID %lu: %s\n"),
     -                  Prog, (unsigned long) uid, strerrno());
    @@ src/usermod.c: prepend_range(const char *str, struct id_range_list_entry **head)
        }
        entry->next = *head;
     @@ src/usermod.c: static void update_lastlog (void)
    -   fd = open (LASTLOG_FILE, O_RDWR);
    +   fd = open(_PATH_LASTLOG, O_RDWR);
      
        if (-1 == fd) {
     -          eprintf(_("%s: failed to copy the lastlog entry of user %lu to user %lu: %s\n"),
16:  f773e997 ! 15:  350da966 lib/: Use [v]fprinte() instead of its pattern
    @@ lib/tcbfuncs.c: static shadowtcb_status mkdir_leading (const char *name, uid_t u
     +                  shadow_progname, TCB_DIR);
                goto out_free_path;
        }
    -   while ((ind = strchr (ptr, '/'))) {
    +   while (NULL != (ind = strchr(ptr, '/'))) {
     @@ lib/tcbfuncs.c: static shadowtcb_status mkdir_leading (const char *name, uid_t uid)
                        return SHADOWTCB_FAILURE;
                }
17:  93b6a5fc = 16:  64d4993c lib/io/syslog.h: SYSLOGE(): Add macro
18:  dc366523 = 17:  dfb25c6c src/userdel.c: Fix error message
19:  0a20d7bf = 18:  3b1b87e4 lib/, src/: Use SYSLOGE() instead of its pattern

v8: #1289 (comment)

v8b
  • Fix previous rebase (v8).
$ git range-diff shadow/master gh/eprintf eprintf 
 1:  093ab3f0 =  1:  093ab3f0 lib/getdef.h: Add missing includes
 2:  5f2879a5 =  2:  5f2879a5 lib/io/fprintf/: eprintf(): Add function to print to stderr
 3:  224ebc52 =  3:  224ebc52 lib/, src/: Use eprintf() instead of its pattern
 4:  86d632c8 =  4:  86d632c8 lib/string/: strerrno(): Add function
 5:  931f9e4b =  5:  931f9e4b lib/, src/: Use strerrno() instead of its pattern
 6:  2e5885c8 !  6:  89e91e48 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
    @@ src/grpunconv.c: int main (int argc, char **argv)
        if (unlink(_PATH_GSHADOW) != 0) {
                eprintf(_("%s: cannot delete %s\n"), Prog, _PATH_GSHADOW);
     -          SYSLOG((LOG_ERR, "cannot delete %s", _PATH_GSHADOW));
    -+          SYSLOG(LOG_ERR, "cannot delete %s", SGROUP_FILE);
    ++          SYSLOG(LOG_ERR, "cannot delete %s", _PATH_GSHADOW);
                fail_exit (3, process_selinux);
        }
      
 7:  0d4af870 =  7:  6b17f1be lib/: Move <syslog.h> wrappers to "io/syslog.h"
 8:  d22e486c =  8:  0807708a lib/io/syslog.h: SYSLOG_C(): Split code to helper macro
 9:  aace99d5 =  9:  92d14578 lib/io/syslog.h: Rename local variable
10:  0d718f3b = 10:  928b2285 lib/io/syslog.h: SYSLOG_C(): Use a single local variable
11:  2d142ecf = 11:  78571ba2 lib/io/syslog.h: SYSLOG_C(): Call setlocale(3) and free(3) unconditionally
12:  17a5a34a = 12:  8df579dd lib/io/fprintf/: [v]fprinte(): Add function
13:  af7f8cb6 = 13:  7bf404c5 lib/io/fprintf/: [v]eprinte(): Add function
14:  9ae067f8 = 14:  d9fc1d94 lib/, src/: Use eprinte() instead of its pattern
15:  85698a10 = 15:  78cccbd7 lib/: Use [v]fprinte() instead of its pattern
16:  69dbc822 = 16:  171454ec lib/io/syslog.h: SYSLOGE(): Add macro
17:  300e074d = 17:  db55a04a src/userdel.c: Fix error message
18:  65c2e9cc = 18:  86ca0d69 lib/, src/: Use SYSLOGE() instead of its pattern
v9
$ git range-diff shadow/master..gh/eprintf gh/strerrno..eprintf 
 1:  093ab3f0 <  -:  -------- lib/getdef.h: Add missing includes
 2:  5f2879a5 =  1:  f311d59c lib/io/fprintf/: eprintf(): Add function to print to stderr
 3:  224ebc52 !  2:  e3a68500 lib/, src/: Use eprintf() instead of its pattern
    @@ lib/get_pid.c
     +#include "io/fprintf/eprintf.h"
      #include "prototypes.h"
      #include "string/sprintf/snprintf.h"
    - 
    + #include "string/strerrno.h"
     @@ lib/get_pid.c: int open_pidfd(const char *pidstr)
                return -ENOENT;
      
        if (SNPRINTF(proc_dir_name, "/proc/%d/", target) == -1) {
     -          fprintf(stderr, "snprintf of proc path failed for %d: %s\n",
     +          eprintf("snprintf of proc path failed for %d: %s\n",
    -                   target, strerror(errno));
    +                   target, strerrno());
                return -EINVAL;
        }
      
    @@ lib/get_pid.c: int open_pidfd(const char *pidstr)
        if (proc_dir_fd < 0) {
     -          fprintf(stderr, _("Could not open proc directory for target %d: %s\n"),
     +          eprintf(_("Could not open proc directory for target %d: %s\n"),
    -                   target, strerror(errno));
    +                   target, strerrno());
                return -EINVAL;
        }
     
    @@ src/chage.c: int main (int argc, char **argv)
                     || (setreuid (ruid, ruid) != 0))) {
     -          fprintf (stderr, _("%s: failed to drop privileges (%s)\n"),
     +          eprintf(_("%s: failed to drop privileges (%s)\n"),
    -                    Prog, strerror (errno));
    +                    Prog, strerrno());
                fail_exit (E_NOPERM, process_selinux);
        }
      
    @@ src/chgpasswd.c: int main (int argc, char **argv)
     -                          fprintf (stderr,
     -                                   _("%s: failed to crypt password with salt '%s': %s\n"),
     +                          eprintf(_("%s: failed to crypt password with salt '%s': %s\n"),
    -                                    Prog, salt, strerror (errno));
    +                                   Prog, salt, strerrno());
                                fail_exit (1, process_selinux);
                        }
     @@ src/chgpasswd.c: int main (int argc, char **argv)
    @@ src/chpasswd.c: int main (int argc, char **argv)
     -                          fprintf (stderr,
     -                                   _("%s: failed to crypt password with salt '%s': %s\n"),
     +                          eprintf(_("%s: failed to crypt password with salt '%s': %s\n"),
    -                                    Prog, salt, strerror (errno));
    +                                   Prog, salt, strerrno());
                                fail_exit (1, process_selinux);
                        }
     @@ src/chpasswd.c: int main (int argc, char **argv)
    @@ src/faillog.c: int main (int argc, char **argv)
     -          fprintf (stderr,
     -                   _("%s: Cannot open %s: %s\n"),
     +          eprintf(_("%s: Cannot open %s: %s\n"),
    -                    Prog, FAILLOG_FILE, strerror (errno));
    +                   Prog, FAILLOG_FILE, strerrno());
                exit (E_NOPERM);
        }
      
    @@ src/faillog.c: int main (int argc, char **argv)
     -          fprintf (stderr,
     -                   _("%s: Cannot get the size of %s: %s\n"),
     +          eprintf(_("%s: Cannot get the size of %s: %s\n"),
    -                    Prog, FAILLOG_FILE, strerror (errno));
    +                   Prog, FAILLOG_FILE, strerrno());
                exit (E_NOPERM);
        }
     @@ src/faillog.c: int main (int argc, char **argv)
    @@ src/faillog.c: int main (int argc, char **argv)
     -                  fprintf (stderr,
     -                           _("%s: Failed to write %s: %s\n"),
     +                  eprintf(_("%s: Failed to write %s: %s\n"),
    -                            Prog, FAILLOG_FILE, strerror (errno));
    +                           Prog, FAILLOG_FILE, strerrno());
                        (void) fclose (fail);
                        errors = true;
     
    @@ src/gpasswd.c: static void change_passwd (struct group *gr)
     -          fprintf (stderr,
     -                   _("%s: failed to crypt password with salt '%s': %s\n"),
     +          eprintf(_("%s: failed to crypt password with salt '%s': %s\n"),
    -                    Prog, salt, strerror (errno));
    +                   Prog, salt, strerrno());
                exit (1);
        }
     @@ src/gpasswd.c: int main (int argc, char **argv)
    @@ src/groupadd.c: static void open_files (struct option_flags *flags)
      
        /* And now open the databases */
        if (gr_open (O_CREAT | O_RDWR) == 0) {
    --          fprintf (stderr, _("%s: cannot open %s: %s\n"), Prog, gr_dbname (), strerror(errno));
    -+          eprintf(_("%s: cannot open %s: %s\n"), Prog, gr_dbname(), strerror(errno));
    -           SYSLOG ((LOG_WARN, "cannot open %s: %s", gr_dbname (), strerror(errno)));
    +-          fprintf(stderr, _("%s: cannot open %s: %s\n"), Prog, gr_dbname(), strerrno());
    ++          eprintf(_("%s: cannot open %s: %s\n"), Prog, gr_dbname(), strerrno());
    +           SYSLOG((LOG_WARN, "cannot open %s: %s", gr_dbname(), strerrno()));
                fail_exit (E_GRP_UPDATE);
        }
     @@ src/groupadd.c: static void open_files (struct option_flags *flags)
    @@ src/groupadd.c: static void open_files (struct option_flags *flags)
                if (sgr_open (O_CREAT | O_RDWR) == 0) {
     -                  fprintf (stderr,
     -                           _("%s: cannot open %s: %s\n"),
    -+                  eprintf(_("%s: cannot open %s: %s\n"),
    -                            Prog, sgr_dbname (), strerror(errno));
    -                   SYSLOG ((LOG_WARN, "cannot open %s: %s", sgr_dbname (), strerror(errno)));
    +-                           Prog, sgr_dbname(), strerrno());
    ++                  eprintf(_("%s: cannot open %s: %s\n"), Prog, sgr_dbname(), strerrno());
    +                   SYSLOG((LOG_WARN, "cannot open %s: %s", sgr_dbname(), strerrno()));
                        fail_exit (E_GRP_UPDATE);
    +           }
     @@ src/groupadd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
                        gflg = true;
                        if (   (get_gid(optarg, &group_id) == -1)
    @@ src/lastlog.c: int main (int argc, char **argv)
     -          fprintf (stderr,
     -                   _("%s: Cannot get the size of %s: %s\n"),
     +          eprintf(_("%s: Cannot get the size of %s: %s\n"),
    -                    Prog, _PATH_LASTLOG, strerror(errno));
    +                   Prog, _PATH_LASTLOG, strerrno());
                exit (EXIT_FAILURE);
        }
     
    @@ src/login.c: int main (int argc, char **argv)
        child = fork ();
        if (child < 0) {
                /* error in fork() */
    --          fprintf (stderr, _("%s: failure forking: %s"),
    --                   Prog, strerror (errno));
    -+          eprintf(_("%s: failure forking: %s"), Prog, strerror(errno));
    +-          fprintf(stderr, _("%s: failure forking: %s"), Prog, strerrno());
    ++          eprintf(_("%s: failure forking: %s"), Prog, strerrno());
                PAM_END;
                exit (0);
        } else if (child != 0) {
    @@ src/newgidmap.c: static void write_setgroups(int proc_dir_fd, bool allow_setgrou
                        goto out;
                }
     -          fprintf(stderr, _("%s: couldn't open process setgroups: %s\n"),
    -+          eprintf(_("%s: couldn't open process setgroups: %s\n"),
    -                   Prog,
    -                   strerror(errno));
    +-                  Prog, strerrno());
    ++          eprintf(_("%s: couldn't open process setgroups: %s\n"), Prog, strerrno());
                exit(EXIT_FAILURE);
    +   }
    + 
     @@ src/newgidmap.c: static void write_setgroups(int proc_dir_fd, bool allow_setgroups)
         * fail.
         */
        if (read(setgroups_fd, policy_buffer, sizeof(policy_buffer)) < 0) {
     -          fprintf(stderr, _("%s: failed to read setgroups: %s\n"),
    -+          eprintf(_("%s: failed to read setgroups: %s\n"),
    -                   Prog,
    -                   strerror(errno));
    +-                  Prog, strerrno());
    ++          eprintf(_("%s: failed to read setgroups: %s\n"), Prog, strerrno());
                exit(EXIT_FAILURE);
    +   }
    +   if (strprefix(policy_buffer, policy))
     @@ src/newgidmap.c: static void write_setgroups(int proc_dir_fd, bool allow_setgroups)
      
        /* Write the policy. */
        if (lseek(setgroups_fd, 0, SEEK_SET) < 0) {
     -          fprintf(stderr, _("%s: failed to seek setgroups: %s\n"),
    -+          eprintf(_("%s: failed to seek setgroups: %s\n"),
    -                   Prog,
    -                   strerror(errno));
    +-                  Prog, strerrno());
    ++          eprintf(_("%s: failed to seek setgroups: %s\n"), Prog, strerrno());
                exit(EXIT_FAILURE);
        }
        if (dprintf(setgroups_fd, "%s", policy) < 0) {
     -          fprintf(stderr, _("%s: failed to setgroups %s policy: %s\n"),
     +          eprintf(_("%s: failed to setgroups %s policy: %s\n"),
    -                   Prog,
    -                   policy,
    -                   strerror(errno));
    +                   Prog, policy, strerrno());
    +           exit(EXIT_FAILURE);
    +   }
     @@ src/newgidmap.c: int main(int argc, char **argv)
        /* Who am I? */
        pw = get_my_pwent ();
    @@ src/newgidmap.c: int main(int argc, char **argv)
     -          fprintf(stderr,
     -                  _("%s: Could not stat directory for target process: %s\n"),
     +          eprintf(_("%s: Could not stat directory for target process: %s\n"),
    -                   Prog, strerror (errno));
    +                   Prog, strerrno());
                return EXIT_FAILURE;
        }
     @@ src/newgidmap.c: int main(int argc, char **argv)
    @@ src/newgidmap.c: int main(int argc, char **argv)
        if (want_subgid_file() && !sub_gid_open(O_RDONLY)) {
     -          fprintf (stderr,
     -                   _("%s: cannot open %s: %s\n"),
    -+          eprintf(_("%s: cannot open %s: %s\n"),
    -                    Prog, sub_gid_dbname (), strerror (errno));
    +-                   Prog, sub_gid_dbname(), strerrno());
    ++          eprintf(_("%s: cannot open %s: %s\n"), Prog, sub_gid_dbname(), strerrno());
                return EXIT_FAILURE;
        }
    + 
     
      ## src/newgrp.c ##
     @@
    @@ src/newgrp.c: static void check_perms (const struct group *grp,
     -                  fprintf (stderr,
     -                           _("%s: failed to crypt password with previous salt: %s\n"),
     +                  eprintf(_("%s: failed to crypt password with previous salt: %s\n"),
    -                            Prog, strerror (errno));
    +                           Prog, strerrno());
                        SYSLOG ((LOG_INFO,
                                 "Failed to crypt password with previous salt of group '%s'",
     @@ src/newgrp.c: static void syslog_sg (const char *name, const char *group)
    @@ src/newgrp.c: static void syslog_sg (const char *name, const char *group)
                        /* error in fork() */
     -                  fprintf (stderr, _("%s: failure forking: %s\n"),
     +                  eprintf(_("%s: failure forking: %s\n"),
    -                            is_newgrp ? "newgrp" : "sg", strerror (errno));
    +                           is_newgrp ? "newgrp" : "sg", strerrno());
      #ifdef WITH_AUDIT
                        if (group) {
     @@ src/newgrp.c: int main (int argc, char **argv)
    @@ src/newuidmap.c: int main(int argc, char **argv)
     -          fprintf(stderr,
     -                  _("%s: Could not stat directory for target process: %s\n"),
     +          eprintf(_("%s: Could not stat directory for target process: %s\n"),
    -                   Prog, strerror (errno));
    +                   Prog, strerrno());
                return EXIT_FAILURE;
        }
     @@ src/newuidmap.c: int main(int argc, char **argv)
    @@ src/newuidmap.c: int main(int argc, char **argv)
     -          fprintf (stderr,
     -                   _("%s: cannot open %s: %s\n"),
     +          eprintf(_("%s: cannot open %s: %s\n"),
    -                    Prog, sub_uid_dbname (), strerror (errno));
    +                   Prog, sub_uid_dbname(), strerrno());
                return EXIT_FAILURE;
        }
     
    @@ src/newusers.c: static int update_passwd (struct passwd *pwd, const char *passwo
     -                  fprintf (stderr,
     -                           _("%s: failed to crypt password with salt '%s': %s\n"),
     +                  eprintf(_("%s: failed to crypt password with salt '%s': %s\n"),
    -                            Prog, salt, strerror (errno));
    +                           Prog, salt, strerrno());
                        return 1;
                }
     @@ src/newusers.c: static int add_passwd (struct passwd *pwd, const char *password)
    @@ src/newusers.c: static int add_passwd (struct passwd *pwd, const char *password)
     -                          fprintf (stderr,
     -                                   _("%s: failed to crypt password with salt '%s': %s\n"),
     +                          eprintf(_("%s: failed to crypt password with salt '%s': %s\n"),
    -                                    Prog, salt, strerror (errno));
    +                                   Prog, salt, strerrno());
                                return 1;
                        }
     @@ src/newusers.c: static int add_passwd (struct passwd *pwd, const char *password)
    @@ src/newusers.c: static int add_passwd (struct passwd *pwd, const char *password)
     -                  fprintf (stderr,
     -                           _("%s: failed to crypt password with salt '%s': %s\n"),
     +                  eprintf(_("%s: failed to crypt password with salt '%s': %s\n"),
    -                            Prog, salt, strerror (errno));
    +                           Prog, salt, strerrno());
                        return 1;
                }
     @@ src/newusers.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/newusers.c: int main (int argc, char **argv)
                usernames = REALLOCF(usernames, nusers, char *);
                passwords = REALLOCF(passwords, nusers, char *);
                if (lines == NULL || usernames == NULL || passwords == NULL) {
    --                  fprintf (stderr,
    --                           _("%s: line %jd: %s\n"),
    --                           Prog, line, strerror(errno));
    -+                  eprintf(_("%s: line %jd: %s\n"), Prog, line, strerror(errno));
    +-                  fprintf(stderr, _("%s: line %jd: %s\n"), Prog, line, strerrno());
    ++                  eprintf(_("%s: line %jd: %s\n"), Prog, line, strerrno());
                        fail_exit (EXIT_FAILURE, process_selinux);
                }
                lines[nusers-1]     = line;
    @@ src/newusers.c: int main (int argc, char **argv)
     -                          fprintf (stderr,
     -                                   _("%s: line %jd: mkdir %s failed: %s\n"),
     +                          eprintf(_("%s: line %jd: mkdir %s failed: %s\n"),
    -                                    Prog, line, newpw.pw_dir,
    -                                    strerror (errno));
    +                                   Prog, line, newpw.pw_dir, strerrno());
                                if (errno != EEXIST) {
    +                                   fail_exit (EXIT_FAILURE, process_selinux);
     @@ src/newusers.c: int main (int argc, char **argv)
                        }
                        if (chown(newpw.pw_dir, newpw.pw_uid, newpw.pw_gid) != 0)
    @@ src/newusers.c: int main (int argc, char **argv)
     -                          fprintf (stderr,
     -                                   _("%s: line %jd: chown %s failed: %s\n"),
     +                          eprintf(_("%s: line %jd: chown %s failed: %s\n"),
    -                                    Prog, line, newpw.pw_dir,
    -                                    strerror (errno));
    +                                   Prog, line, newpw.pw_dir, strerrno());
                                fail_exit (EXIT_FAILURE, process_selinux);
    +                   }
     @@ src/newusers.c: int main (int argc, char **argv)
                 * Update the password entry with the new changes made.
                 */
    @@ src/passwd.c: static int new_password (const struct passwd *pw)
     -                  fprintf (stderr,
     -                           _("%s: failed to crypt password with previous salt: %s\n"),
     +                  eprintf(_("%s: failed to crypt password with previous salt: %s\n"),
    -                            Prog, strerror (errno));
    +                            Prog, strerrno());
                        SYSLOG ((LOG_INFO,
                                 "Failed to crypt password with previous salt of user '%s'",
     @@ src/passwd.c: static int new_password (const struct passwd *pw)
    @@ src/passwd.c: static int new_password (const struct passwd *pw)
     -          fprintf (stderr,
     -                   _("%s: failed to crypt password with salt '%s': %s\n"),
     +          eprintf(_("%s: failed to crypt password with salt '%s': %s\n"),
    -                    Prog, salt, strerror (errno));
    +                    Prog, salt, strerrno());
                return -1;
        }
     @@ src/passwd.c: static void check_password (const struct passwd *pw, const struct spwd *sp)
    @@ src/useradd.c: set_defaults(void)
        if (new_file == NULL) {
     -          fprintf(stderr, _("%s: cannot create new defaults file: %s\n"),
     +          eprintf(_("%s: cannot create new defaults file: %s\n"),
    -                   Prog, strerror(errno));
    +                   Prog, strerrno());
                return -1;
              }
     @@ src/useradd.c: set_defaults(void)
    @@ src/useradd.c: set_defaults(void)
     -                  fprintf(stderr,
     -                          _("%s: cannot create new defaults file: %s\n"),
     +                  eprintf(_("%s: cannot create new defaults file: %s\n"),
    -                           Prog, strerror(errno));
    +                           Prog, strerrno());
                        goto err_free_new;
                }
     @@ src/useradd.c: set_defaults(void)
    @@ src/useradd.c: static void faillog_reset (uid_t uid)
     -          fprintf (stderr,
     -                   _("%s: failed to open the faillog file for UID %lu: %s\n"),
     +          eprintf(_("%s: failed to open the faillog file for UID %lu: %s\n"),
    -                    Prog, (unsigned long) uid, strerror (errno));
    +                   Prog, (unsigned long) uid, strerrno());
                SYSLOG ((LOG_WARN, "failed to open the faillog file for UID %lu", (unsigned long) uid));
                return;
     @@ src/useradd.c: static void faillog_reset (uid_t uid)
    @@ src/useradd.c: static void faillog_reset (uid_t uid)
     -          fprintf (stderr,
     -                   _("%s: failed to reset the faillog entry of UID %lu: %s\n"),
     +          eprintf(_("%s: failed to reset the faillog entry of UID %lu: %s\n"),
    -                    Prog, (unsigned long) uid, strerror (errno));
    +                   Prog, (unsigned long) uid, strerrno());
                SYSLOG ((LOG_WARN, "failed to reset the faillog entry of UID %lu", (unsigned long) uid));
        }
        if (close (fd) != 0 && errno != EINTR) {
     -          fprintf (stderr,
     -                   _("%s: failed to close the faillog file for UID %lu: %s\n"),
     +          eprintf(_("%s: failed to close the faillog file for UID %lu: %s\n"),
    -                    Prog, (unsigned long) uid, strerror (errno));
    +                   Prog, (unsigned long) uid, strerrno());
                SYSLOG ((LOG_WARN, "failed to close the faillog file for UID %lu", (unsigned long) uid));
        }
     @@ src/useradd.c: static void lastlog_reset (uid_t uid)
    @@ src/useradd.c: static void lastlog_reset (uid_t uid)
     -          fprintf (stderr,
     -                   _("%s: failed to open the lastlog file for UID %lu: %s\n"),
     +          eprintf(_("%s: failed to open the lastlog file for UID %lu: %s\n"),
    -                    Prog, (unsigned long) uid, strerror (errno));
    +                   Prog, (unsigned long) uid, strerrno());
                SYSLOG ((LOG_WARN, "failed to open the lastlog file for UID %lu", (unsigned long) uid));
                return;
     @@ src/useradd.c: static void lastlog_reset (uid_t uid)
    @@ src/useradd.c: static void lastlog_reset (uid_t uid)
     -          fprintf (stderr,
     -                   _("%s: failed to reset the lastlog entry of UID %lu: %s\n"),
     +          eprintf(_("%s: failed to reset the lastlog entry of UID %lu: %s\n"),
    -                    Prog, (unsigned long) uid, strerror (errno));
    +                   Prog, (unsigned long) uid, strerrno());
                SYSLOG ((LOG_WARN, "failed to reset the lastlog entry of UID %lu", (unsigned long) uid));
                /* continue */
        }
    @@ src/useradd.c: static void lastlog_reset (uid_t uid)
     -          fprintf (stderr,
     -                   _("%s: failed to close the lastlog file for UID %lu: %s\n"),
     +          eprintf(_("%s: failed to close the lastlog file for UID %lu: %s\n"),
    -                    Prog, (unsigned long) uid, strerror (errno));
    +                   Prog, (unsigned long) uid, strerrno());
                SYSLOG ((LOG_WARN, "failed to close the lastlog file for UID %lu", (unsigned long) uid));
                /* continue */
     @@ src/useradd.c: static void tallylog_reset (const char *user_name)
    @@ src/userdel.c: static bool remove_mailbox (void)
     -                  fprintf (stderr,
     -                           _("%s: warning: can't remove %s: %s\n"),
     +                  eprintf(_("%s: warning: can't remove %s: %s\n"),
    -                            Prog, mailfile, strerror (errno));
    -                   SYSLOG ((LOG_ERR, "Cannot remove %s: %s", mailfile, strerror (errno)));
    +                           Prog, mailfile, strerrno());
    +                   SYSLOG((LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno()));
      #ifdef WITH_AUDIT
     @@ src/userdel.c: static bool remove_mailbox (void)
      
    @@ src/userdel.c: static bool remove_mailbox (void)
     -                  fprintf (stderr,
     -                           _("%s: warning: can't remove %s: %s\n"),
     +                  eprintf(_("%s: warning: can't remove %s: %s\n"),
    -                            Prog, mailfile, strerror (errno));
    -                   SYSLOG ((LOG_ERR, "Cannot remove %s: %s", mailfile, strerror (errno)));
    +                           Prog, mailfile, strerrno());
    +                   SYSLOG((LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno()));
      #ifdef WITH_AUDIT
     @@ src/userdel.c: static bool remove_mailbox (void)
        }
    @@ src/userdel.c: static bool remove_mailbox (void)
     -                   _("%s: %s not owned by %s, not removing\n"),
     +          eprintf(_("%s: %s not owned by %s, not removing\n"),
                         Prog, mailfile, user_name);
    -           SYSLOG ((LOG_ERR,
    -                    "%s not owned by %s, not removed",
    +           SYSLOG((LOG_ERR, "%s not owned by %s, not removed", mailfile, strerrno()));
    + #ifdef WITH_AUDIT
     @@ src/userdel.c: static bool remove_mailbox (void)
                return 0;               /* mailbox doesn't exist */
        }
        if (unlink (mailfile) != 0) {
     -          fprintf (stderr,
     -                   _("%s: warning: can't remove %s: %s\n"),
    -+          eprintf(_("%s: warning: can't remove %s: %s\n"),
    -                    Prog, mailfile, strerror (errno));
    -           SYSLOG ((LOG_ERR, "Cannot remove %s: %s", mailfile, strerror (errno)));
    +-                   Prog, mailfile, strerrno());
    ++          eprintf(_("%s: warning: can't remove %s: %s\n"), Prog, mailfile, strerrno());
    +           SYSLOG((LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno()));
      #ifdef WITH_AUDIT
    +           audit_logger (AUDIT_DEL_USER, Prog,
     @@ src/userdel.c: static int remove_tcbdir (const char *user_name, uid_t user_id)
      
        buf = aprintf(TCB_DIR "/%s", user_name);
    @@ src/userdel.c: static int remove_tcbdir (const char *user_name, uid_t user_id)
        }
        if (shadowtcb_drop_priv () == SHADOWTCB_FAILURE) {
     -          fprintf (stderr, _("%s: Cannot drop privileges: %s\n"),
    -+          eprintf(_("%s: Cannot drop privileges: %s\n"),
    -                    Prog, strerror (errno));
    +-                   Prog, strerrno());
    ++          eprintf(_("%s: Cannot drop privileges: %s\n"), Prog, strerrno());
                shadowtcb_gain_priv ();
                free (buf);
    +           return 1;
     @@ src/userdel.c: static int remove_tcbdir (const char *user_name, uid_t user_id)
         * We will regain them and remove the user's tcb directory afterwards.
         */
        if (remove_tree (buf, false) != 0) {
     -          fprintf (stderr, _("%s: Cannot remove the content of %s: %s\n"),
     +          eprintf(_("%s: Cannot remove the content of %s: %s\n"),
    -                    Prog, buf, strerror (errno));
    +                   Prog, buf, strerrno());
                shadowtcb_gain_priv ();
                free (buf);
     @@ src/userdel.c: static int remove_tcbdir (const char *user_name, uid_t user_id)
    @@ src/userdel.c: static int remove_tcbdir (const char *user_name, uid_t user_id)
        if (shadowtcb_remove (user_name) == SHADOWTCB_FAILURE) {
     -          fprintf (stderr, _("%s: Cannot remove tcb files for %s: %s\n"),
     +          eprintf(_("%s: Cannot remove tcb files for %s: %s\n"),
    -                    Prog, user_name, strerror (errno));
    +                   Prog, user_name, strerrno());
                ret = 1;
        }
     @@ src/userdel.c: int main (int argc, char **argv)
    @@ src/usermod.c: prepend_range(const char *str, struct id_range_list_entry **head)
        if (!entry) {
     -          fprintf (stderr,
     -                  _("%s: failed to allocate memory: %s\n"),
    -+          eprintf(_("%s: failed to allocate memory: %s\n"),
    -                   Prog, strerror (errno));
    +-                  Prog, strerrno());
    ++          eprintf(_("%s: failed to allocate memory: %s\n"), Prog, strerrno());
                return 0;
        }
    +   entry->next = *head;
     @@ src/usermod.c: static char *new_pw_passwd (char *pw_pass)
                pw_pass = xaprintf("!%s", pw_pass);
        } else if (Uflg && strprefix(pw_pass, "!")) {
    @@ src/usermod.c: static void update_lastlog (void)
     -          fprintf (stderr,
     -                   _("%s: failed to copy the lastlog entry of user %lu to user %lu: %s\n"),
     +          eprintf(_("%s: failed to copy the lastlog entry of user %lu to user %lu: %s\n"),
    -                    Prog, (unsigned long) user_id, (unsigned long) user_newid, strerror (errno));
    +                   Prog, (unsigned long) user_id, (unsigned long) user_newid, strerrno());
                return;
        }
     @@ src/usermod.c: static void update_lastlog (void)
    @@ src/usermod.c: static void update_lastlog (void)
     -                  fprintf (stderr,
     -                           _("%s: failed to copy the lastlog entry of user %lu to user %lu: %s\n"),
     +                  eprintf(_("%s: failed to copy the lastlog entry of user %lu to user %lu: %s\n"),
    -                            Prog, (unsigned long) user_id, (unsigned long) user_newid, strerror (errno));
    +                           Prog, (unsigned long) user_id, (unsigned long) user_newid, strerrno());
                }
        } else {
     @@ src/usermod.c: static void update_lastlog (void)
    @@ src/usermod.c: static void update_lastlog (void)
     -                          fprintf (stderr,
     -                                   _("%s: failed to copy the lastlog entry of user %lu to user %lu: %s\n"),
     +                          eprintf(_("%s: failed to copy the lastlog entry of user %lu to user %lu: %s\n"),
    -                                    Prog, (unsigned long) user_id, (unsigned long) user_newid, strerror (errno));
    +                                   Prog, (unsigned long) user_id, (unsigned long) user_newid, strerrno());
                        }
                }
        }
    @@ src/usermod.c: static void update_lastlog (void)
     -          fprintf (stderr,
     -                   _("%s: failed to copy the lastlog entry of user %ju to user %ju: %s\n"),
     +          eprintf(_("%s: failed to copy the lastlog entry of user %ju to user %ju: %s\n"),
    -                    Prog, (uintmax_t) user_id, (uintmax_t) user_newid, strerror (errno));
    +                   Prog, (uintmax_t) user_id, (uintmax_t) user_newid, strerrno());
        }
      }
     @@ src/usermod.c: static void update_faillog (void)
    @@ src/usermod.c: static void update_faillog (void)
     -          fprintf (stderr,
     -                   _("%s: failed to copy the faillog entry of user %lu to user %lu: %s\n"),
     +          eprintf(_("%s: failed to copy the faillog entry of user %lu to user %lu: %s\n"),
    -                    Prog, (unsigned long) user_id, (unsigned long) user_newid, strerror (errno));
    +                   Prog, (unsigned long) user_id, (unsigned long) user_newid, strerrno());
                return;
        }
     @@ src/usermod.c: static void update_faillog (void)
    @@ src/usermod.c: static void update_faillog (void)
     -                  fprintf (stderr,
     -                           _("%s: failed to copy the faillog entry of user %lu to user %lu: %s\n"),
     +                  eprintf(_("%s: failed to copy the faillog entry of user %lu to user %lu: %s\n"),
    -                            Prog, (unsigned long) user_id, (unsigned long) user_newid, strerror (errno));
    +                           Prog, (unsigned long) user_id, (unsigned long) user_newid, strerrno());
                }
        } else {
     @@ src/usermod.c: static void update_faillog (void)
    @@ src/usermod.c: static void update_faillog (void)
     -                          fprintf (stderr,
     -                                   _("%s: failed to copy the faillog entry of user %lu to user %lu: %s\n"),
     +                          eprintf(_("%s: failed to copy the faillog entry of user %lu to user %lu: %s\n"),
    -                                    Prog, (unsigned long) user_id, (unsigned long) user_newid, strerror (errno));
    +                                   Prog, (unsigned long) user_id, (unsigned long) user_newid, strerrno());
                        }
                }
        }
    @@ src/usermod.c: static void update_faillog (void)
     -          fprintf (stderr,
     -                   _("%s: failed to copy the faillog entry of user %ju to user %ju: %s\n"),
     +          eprintf(_("%s: failed to copy the faillog entry of user %ju to user %ju: %s\n"),
    -                    Prog, (uintmax_t) user_id, (uintmax_t) user_newid, strerror (errno));
    +                   Prog, (uintmax_t) user_id, (uintmax_t) user_newid, strerrno());
        }
      }
     @@ src/usermod.c: static void move_mailbox (void)
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
      
                status = system (buf);
                if (-1 == status) {
    --                  fprintf (stderr, _("%s: %s: %s\n"), Prog, editor,
    -+                  eprintf(_("%s: %s: %s\n"), Prog, editor,
    -                            strerror (errno));
    +-                  fprintf(stderr, _("%s: %s: %s\n"), Prog, editor, strerrno());
    ++                  eprintf(_("%s: %s: %s\n"), Prog, editor, strerrno());
                        exit (1);
                } else if (   WIFEXITED (status)
                           && (WEXITSTATUS (status) != 0)) {
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
                                if (editor_pgrp == -1) {
     -                                  fprintf (stderr, "%s: %s: %s", Prog,
     +                                  eprintf("%s: %s: %s", Prog,
    -                                            "tcgetpgrp", strerror (errno));
    +                                           "tcgetpgrp", strerrno());
                                }
                                if (tcsetpgrp(STDIN_FILENO, orig_pgrp) == -1) {
     -                                  fprintf (stderr, "%s: %s: %s", Prog,
     +                                  eprintf("%s: %s: %s", Prog,
    -                                            "tcsetpgrp", strerror (errno));
    +                                           "tcsetpgrp", strerrno());
                                }
                        }
     @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
                                if (tcsetpgrp(STDIN_FILENO, editor_pgrp) == -1) {
     -                                  fprintf (stderr, "%s: %s: %s", Prog,
     +                                  eprintf("%s: %s: %s", Prog,
    -                                            "tcsetpgrp", strerror (errno));
    +                                           "tcsetpgrp", strerrno());
                                }
                        }
     @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
        if (orig_pgrp != -1) {
                 /* Restore terminal pgrp after editing. */
                if (tcsetpgrp(STDIN_FILENO, orig_pgrp) == -1) {
    --                  fprintf(stderr, "%s: %s: %s", Prog,
    -+                  eprintf("%s: %s: %s", Prog,
    -                           "tcsetpgrp", strerror(errno));
    +-                  fprintf(stderr, "%s: %s: %s", Prog, "tcsetpgrp", strerrno());
    ++                  eprintf("%s: %s: %s", Prog, "tcsetpgrp", strerrno());
                }
                sigprocmask(SIG_SETMASK, &omask, NULL);
    +   }
     @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
                   && (WEXITSTATUS (status) != 0)) {
                vipwexit (NULL, 0, WEXITSTATUS (status));
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
     -          fprintf (stderr,
     -                   _("%s: can't restore %s: %s (your changes are in %s)\n"),
     +          eprintf(_("%s: can't restore %s: %s (your changes are in %s)\n"),
    -                    Prog, file, strerror (errno), to_rename);
    +                   Prog, file, strerrno(), to_rename);
      #ifdef WITH_TCB
                if (tcb_mode) {
     @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
 4:  86d632c8 <  -:  -------- lib/string/: strerrno(): Add function
 5:  931f9e4b <  -:  -------- lib/, src/: Use strerrno() instead of its pattern
 6:  89e91e48 =  3:  e2e8c983 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
 7:  6b17f1be =  4:  b182024c lib/: Move <syslog.h> wrappers to "io/syslog.h"
 8:  0807708a =  5:  03a3d05c lib/io/syslog.h: SYSLOG_C(): Split code to helper macro
 9:  92d14578 =  6:  c9e628dd lib/io/syslog.h: Rename local variable
10:  928b2285 =  7:  447e46ee lib/io/syslog.h: SYSLOG_C(): Use a single local variable
11:  78571ba2 =  8:  d9e9dffb lib/io/syslog.h: SYSLOG_C(): Call setlocale(3) and free(3) unconditionally
12:  8df579dd =  9:  511051c3 lib/io/fprintf/: [v]fprinte(): Add function
13:  7bf404c5 = 10:  b89bee67 lib/io/fprintf/: [v]eprinte(): Add function
14:  d9fc1d94 = 11:  c8d5afba lib/, src/: Use eprinte() instead of its pattern
15:  78cccbd7 = 12:  e212bedc lib/: Use [v]fprinte() instead of its pattern
16:  171454ec = 13:  74a354bb lib/io/syslog.h: SYSLOGE(): Add macro
17:  db55a04a = 14:  a2dcdc97 src/userdel.c: Fix error message
18:  86ca0d69 = 15:  b3f573b1 lib/, src/: Use SYSLOGE() instead of its pattern
v9b
  • Rebase
$ git range-diff gh/strerrno..gh/eprintf strerrno..eprintf 
 1:  f311d59c =  1:  32d6cd8d lib/io/fprintf/: eprintf(): Add function to print to stderr
 2:  e3a68500 !  2:  12360771 lib/, src/: Use eprintf() instead of its pattern
    @@ src/groupdel.c: int main (int argc, char **argv)
     
      ## src/groupmems.c ##
     @@
    - #include "alloc/x/xmalloc.h"
    + #include "alloc/malloc.h"
      #include "defines.h"
      #include "groupio.h"
     +#include "io/fprintf/eprintf.h"
 3:  e2e8c983 =  3:  54a071ad lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
 4:  b182024c =  4:  058dddb6 lib/: Move <syslog.h> wrappers to "io/syslog.h"
 5:  03a3d05c =  5:  3e3f1c12 lib/io/syslog.h: SYSLOG_C(): Split code to helper macro
 6:  c9e628dd =  6:  c9001a70 lib/io/syslog.h: Rename local variable
 7:  447e46ee =  7:  56aade53 lib/io/syslog.h: SYSLOG_C(): Use a single local variable
 8:  d9e9dffb =  8:  5b720d6d lib/io/syslog.h: SYSLOG_C(): Call setlocale(3) and free(3) unconditionally
 9:  511051c3 =  9:  e9fc6219 lib/io/fprintf/: [v]fprinte(): Add function
10:  b89bee67 = 10:  745e0633 lib/io/fprintf/: [v]eprinte(): Add function
11:  c8d5afba ! 11:  7ad63296 lib/, src/: Use eprinte() instead of its pattern
    @@ src/chage.c
      #include "io/fprintf/eprintf.h"
      #include "prototypes.h"
      #include "pwio.h"
    -@@
    - #include "string/strcmp/streq.h"
    - #include "string/strcpy/strtcpy.h"
    - #include "string/strdup/xstrdup.h"
    --#include "string/strerrno.h"
    - #include "string/strftime.h"
    - #include "time/day_to_str.h"
    - /*@-exitarg@*/
     @@ src/chage.c: int main (int argc, char **argv)
        /* Drop privileges */
        if (lflg && (   (setregid (rgid, rgid) != 0)
    @@ src/gpasswd.c
      #include "io/fprintf/eprintf.h"
      #include "nscd.h"
      #include "prototypes.h"
    -@@
    - #include "string/strcmp/streq.h"
    - #include "string/strcpy/strtcpy.h"
    - #include "string/strdup/xstrdup.h"
    --#include "string/strerrno.h"
    - 
    - struct option_flags {
    -   bool chroot;
     @@ src/gpasswd.c: static void change_passwd (struct group *gr)
        cp = pw_encrypt (pass, salt);
        MEMZERO(pass);
    @@ src/login.c
      #include "io/fprintf/eprintf.h"
      #include "prototypes.h"
      #include "pwauth.h"
    -@@
    - #include "string/strcmp/strprefix.h"
    - #include "string/strcpy/strtcpy.h"
    - #include "string/strdup/xstrdup.h"
    --#include "string/strerrno.h"
    - #include "string/strftime.h"
    - 
    - 
     @@ src/login.c: int main (int argc, char **argv)
        child = fork ();
        if (child < 0) {
    @@ src/newgrp.c
      #include "io/fprintf/eprintf.h"
      #include "prototypes.h"
      #include "search/l/lfind.h"
    -@@
    - #include "string/strcmp/streq.h"
    - #include "string/strcmp/strprefix.h"
    - #include "string/strdup/xstrdup.h"
    --#include "string/strerrno.h"
    - 
    - #include <assert.h>
    - 
     @@ src/newgrp.c: static void check_perms (const struct group *grp,
                erase_pass (cp);
      
    @@ src/newusers.c
      #include "io/fprintf/eprintf.h"
      #include "nscd.h"
      #include "prototypes.h"
    -@@
    - #include "string/sprintf/snprintf.h"
    - #include "string/strcmp/streq.h"
    - #include "string/strdup/xstrdup.h"
    --#include "string/strerrno.h"
    - #include "string/strtok/stpsep.h"
    - #include "string/strtok/strsep2arr.h"
    - 
     @@ src/newusers.c: static int update_passwd (struct passwd *pwd, const char *password)
                const char *salt = crypt_make_salt (crypt_method, crypt_arg);
                cp = pw_encrypt (password, salt);
    @@ src/passwd.c
      #include "io/fprintf/eprintf.h"
      #include "nscd.h"
      #include "prototypes.h"
    -@@
    - #include "string/strcmp/strprefix.h"
    - #include "string/strcpy/strtcpy.h"
    - #include "string/strdup/xstrdup.h"
    --#include "string/strerrno.h"
    - #include "time/day_to_str.h"
    - 
    - 
     @@ src/passwd.c: static int new_password (const struct passwd *pw)
      
                if (NULL == cipher) {
    @@ src/useradd.c
      #include "io/fprintf/eprintf.h"
      #include "nscd.h"
      #include "prototypes.h"
    -@@
    - #include "string/strcmp/streq.h"
    - #include "string/strcmp/strprefix.h"
    - #include "string/strdup/xstrdup.h"
    --#include "string/strerrno.h"
    - #include "string/strtok/stpsep.h"
    - 
    - 
     @@ src/useradd.c: set_defaults(void)
      
        new_file = aprintf("%s%s%s", prefix, prefix[0]?"/":"", NEW_USER_FILE);
    @@ src/usermod.c
      #include "io/fprintf/eprintf.h"
      #include "nscd.h"
      #include "prototypes.h"
    -@@
    - #include "string/strcmp/streq.h"
    - #include "string/strcmp/strprefix.h"
    - #include "string/strdup/xstrdup.h"
    --#include "string/strerrno.h"
    - #include "time/day_to_str.h"
    - #include "typetraits.h"
    - 
     @@ src/usermod.c: prepend_range(const char *str, struct id_range_list_entry **head)
      
        entry = MALLOC(1, struct id_range_list_entry);
    @@ src/vipw.c
      #include "nscd.h"
      #include "prototypes.h"
     @@
    + #include "string/sprintf/aprintf.h"
      #include "string/sprintf/snprintf.h"
    - #include "string/sprintf/xaprintf.h"
      #include "string/strcmp/streq.h"
     -#include "string/strerrno.h"
      
12:  e212bedc ! 12:  96a193a7 lib/: Use [v]fprinte() instead of its pattern
    @@ lib/addgrps.c: add_groups(const char *list)
        }
      
     
    - ## lib/alloc/x/xcalloc.c ##
    -@@
    - #include <string.h>
    - 
    - #include "defines.h"
    -+#include "io/fprintf/fprinte.h"
    - #include "shadowlog.h"
    --#include "string/strerrno.h"
    - 
    - 
    - void *
    -@@ lib/alloc/x/xcalloc.c: xcalloc(size_t nmemb, size_t size)
    -   return p;
    - 
    - x:
    --  fprintf(log_get_logfd(), _("%s: %s\n"), log_get_progname(), strerrno());
    -+  fprinte(log_get_logfd(), "%s", log_get_progname());
    -   exit(13);
    - }
    -
    - ## lib/alloc/x/xrealloc.c ##
    -@@
    - 
    - #include "alloc/reallocf.h"
    - #include "defines.h"
    -+#include "io/fprintf/fprinte.h"
    - #include "shadowlog.h"
    --#include "string/strerrno.h"
    - 
    - 
    - void *
    -@@ lib/alloc/x/xrealloc.c: xreallocarray(void *p, size_t nmemb, size_t size)
    -   return p;
    - 
    - x:
    --  fprintf(log_get_logfd(), _("%s: %s\n"), log_get_progname(), strerrno());
    -+  fprinte(log_get_logfd(), "%s", log_get_progname());
    -   exit(13);
    - }
    -
      ## lib/chowntty.c ##
     @@
      #include <stdio.h>
    @@ lib/commonio.c: static int do_lock_file (const char *file, const char *lock, boo
     
      ## lib/copydir.c ##
     @@
    - #include "alloc/x/xmalloc.h"
    + #include "alloc/malloc.h"
      #include "attr.h"
      #include "fs/readlink/areadlink.h"
     +#include "io/fprintf/fprinte.h"
    @@ lib/copydir.c
      #include "defines.h"
      #ifdef WITH_SELINUX
     @@
    - #include "string/sprintf/xaprintf.h"
    + #include "string/sprintf/aprintf.h"
      #include "string/strcmp/streq.h"
      #include "string/strcmp/strprefix.h"
     -#include "string/strerrno.h"
    @@ lib/copydir.c: static void error_acl (MAYBE_UNUSED struct error_context *ctx, co
      }
      
     
    + ## lib/exit_if_null.h ##
    +@@
    + #include <stdio.h>
    + #include <stdlib.h>
    + 
    ++#include "io/fprintf/fprinte.h"
    + #include "shadowlog.h"
    +-#include "string/strerrno.h"
    + 
    + 
    + /*
    +@@ lib/exit_if_null.h: inline void
    + exit_if_null_(void *p)
    + {
    +   if (p == NULL) {
    +-          fprintf(log_get_logfd(), "%s: %s\n", log_get_progname(), strerrno());
    ++          fprinte(log_get_logfd(), "%s", log_get_progname());
    +           exit(13);
    +   }
    + }
    +
      ## lib/find_new_gid.c ##
     @@
      #include <errno.h>
    @@ lib/gettime.c: gettime(void)
     
      ## lib/idmapping.c ##
     @@
    - #include "alloc/x/xmalloc.h"
    + #include "alloc/malloc.h"
      #include "atoi/a2i/a2u.h"
      #include "idmapping.h"
     +#include "io/fprintf/fprinte.h"
    @@ lib/prefix_flag.c
      #ifdef    SHADOWGRP
      #include "sgroupio.h"
     @@
    - #include "string/sprintf/xaprintf.h"
    + #include "string/sprintf/aprintf.h"
      #include "string/strcmp/streq.h"
      #include "string/strcmp/strprefix.h"
     -#include "string/strerrno.h"
    @@ lib/spawn.c: run_command(const char *cmd, const char *argv[],
        }
      
     
    - ## lib/string/strtok/xastrsep2ls.h ##
    -@@
    - #include <string.h>
    - 
    - #include "attr.h"
    -+#include "io/fprintf/fprinte.h"
    - #include "shadowlog.h"
    - #include "string/strtok/astrsep2ls.h"
    --#include "string/strerrno.h"
    - 
    - 
    - ATTR_ACCESS(read_write, 1) ATTR_ACCESS(write_only, 3)
    -@@ lib/string/strtok/xastrsep2ls.h: xastrsep2ls(char *s, const char *restrict delim, size_t *restrict np)
    - 
    -   return ls;
    - x:
    --  fprintf(log_get_logfd(), "%s: %s\n", log_get_progname(), strerrno());
    -+  fprinte(log_get_logfd(), "%s", log_get_progname());
    -   exit(13);
    - }
    - 
    -
      ## lib/tcbfuncs.c ##
     @@
      #include "defines.h"
13:  74a354bb = 13:  b0555c70 lib/io/syslog.h: SYSLOGE(): Add macro
14:  a2dcdc97 = 14:  9ea01862 src/userdel.c: Fix error message
15:  b3f573b1 = 15:  b70f3d85 lib/, src/: Use SYSLOGE() instead of its pattern

@alejandro-colomar
Copy link
Collaborator Author

I recommend reviewing the second commit with

$ git show HEAD^ --color-words=.

@alejandro-colomar alejandro-colomar linked an issue Jul 13, 2025 that may be closed by this pull request
@alejandro-colomar alejandro-colomar force-pushed the eprintf branch 3 times, most recently from 5fa8f9a to c3af808 Compare July 13, 2025 20:44
@ikerexxe
Copy link
Collaborator

I have some reservations about commits 1 and 2. Specifically, the new interface introduced isn't something I've commonly seen in other projects, even though I'm aware of its mention in the GCC documentation. From my perspective, it doesn't appear to offer a significant benefit here.

Furthermore, I'm concerned that commit 2 introduces changes across many files, which could make it quite challenging for distribution maintainers to backport future changes to their distributions. This could lead to a lot of friction and messy patch applications down the line.

On the other hand, I'm fine with the changes in commits 3 and 4. They look good to me.

@alejandro-colomar
Copy link
Collaborator Author

alejandro-colomar commented Jul 17, 2025

I have some reservations about commits 1 and 2. Specifically, the new interface introduced isn't something I've commonly seen in other projects, even though I'm aware of its mention in the GCC documentation. From my perspective, it doesn't appear to offer a significant benefit here.

Furthermore, I'm concerned that commit 2 introduces changes across many files, which could make it quite challenging for distribution maintainers to backport future changes to their distributions. This could lead to a lot of friction and messy patch applications down the line.

Yeah, I guess this would be a lot of work for distros. I'm fine not applying it for now; we can come back to it in the future.

On the other hand, I'm fine with the changes in commits 3 and 4. They look good to me.

I will split patches 3 and 4 to allow applying them separately.

@alejandro-colomar
Copy link
Collaborator Author

alejandro-colomar commented Jul 17, 2025

On the other hand, I plan to do a lot of work on error messages after this eprintf() patch, trying to unify them and use strerror(errno) more, which would significantly reduce translation work. This would similarly force distros to rebase their patches, so I don't see eprintf() as a huge added problem here.

But yeah, we have lower hanging fruits for now.

@alejandro-colomar alejandro-colomar marked this pull request as draft July 20, 2025 13:40
@alejandro-colomar alejandro-colomar marked this pull request as ready for review July 22, 2025 23:25
@alejandro-colomar
Copy link
Collaborator Author

alejandro-colomar commented Jul 22, 2025

@ikerexxe

I think we now have strong reasons to merge this. See the bug fixed in a call to SYSLOG() (and fprintf()).

Edit: I've found more bugs after spending more time looking at these calls.

@alejandro-colomar alejandro-colomar linked an issue Jul 22, 2025 that may be closed by this pull request
@alejandro-colomar alejandro-colomar changed the title Add and use eprintf() Add and use eprintf(), and de-weirdify SYSLOG(()) Jul 22, 2025
@alejandro-colomar alejandro-colomar changed the title Add and use eprintf(), and de-weirdify SYSLOG(()) Add and use eprintf() and strerrno(), and de-weirdify SYSLOG(()) Jul 22, 2025
@alejandro-colomar alejandro-colomar force-pushed the eprintf branch 6 times, most recently from 97d7478 to 68dfb3a Compare July 23, 2025 20:51
@alejandro-colomar alejandro-colomar force-pushed the eprintf branch 2 times, most recently from 55cd6cb to 0a20d7b Compare August 16, 2025 20:32
@alejandro-colomar
Copy link
Collaborator Author

alejandro-colomar commented Oct 19, 2025

v8
  • Rebase
$ git rd -U0 | tee /dev/tty | xclip -selection clipboard
 1:  4c7cdd81 =  1:  093ab3f0 lib/getdef.h: Add missing includes
 2:  c5f7d1ba =  2:  5f2879a5 lib/io/fprintf/: eprintf(): Add function to print to stderr
 3:  e9de5767 !  3:  224ebc52 lib/, src/: Use eprintf() instead of its pattern
    @@ src/chage.c
    -@@ src/chage.c: fail_exit (int code)
    +@@ src/chage.c: fail_exit (int code, bool process_selinux)
    @@ src/chage.c: fail_exit (int code)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/chage.c: fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/chage.c: fail_exit (int code)
    -@@ src/chage.c: static void process_flags (int argc, char **argv)
    +@@ src/chage.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chage.c: static void process_flags (int argc, char **argv)
    -@@ src/chage.c: static void process_flags (int argc, char **argv)
    +@@ src/chage.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chage.c: static void process_flags (int argc, char **argv)
    -@@ src/chage.c: static void process_flags (int argc, char **argv)
    +@@ src/chage.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chage.c: static void process_flags (int argc, char **argv)
    -@@ src/chage.c: static void process_flags (int argc, char **argv)
    +@@ src/chage.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chage.c: static void process_flags (int argc, char **argv)
    -@@ src/chage.c: static void process_flags (int argc, char **argv)
    +@@ src/chage.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chage.c: static void process_flags (int argc, char **argv)
    -@@ src/chage.c: static void process_flags (int argc, char **argv)
    +@@ src/chage.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chage.c: static void check_flags (int argc, int opt_index)
    -@@ src/chage.c: static void check_perms (void)
    +@@ src/chage.c: static void check_perms (struct option_flags *flags)
    @@ src/chage.c: static void check_perms (void)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: static void check_perms (void)
    -@@ src/chage.c: static void open_files (bool readonly)
    +@@ src/chage.c: static void open_files (bool readonly, struct option_flags *flags)
    @@ src/chage.c: static void open_files (bool readonly)
    - 			fail_exit (E_NOPERM);
    + 			fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: static void open_files (bool readonly)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: static void open_files (bool readonly)
    -@@ src/chage.c: static void open_files (bool readonly)
    +@@ src/chage.c: static void open_files (bool readonly, struct option_flags *flags)
    @@ src/chage.c: static void open_files (bool readonly)
    - 			fail_exit (E_NOPERM);
    + 			fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: static void open_files (bool readonly)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: static void open_files (bool readonly)
    -@@ src/chage.c: static void close_files (void)
    +@@ src/chage.c: static void close_files (struct option_flags *flags)
    @@ src/chage.c: static void close_files (void)
    - 	if (spw_close () == 0) {
    + 	if (spw_close (process_selinux) == 0) {
    @@ src/chage.c: static void close_files (void)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: static void close_files (void)
    -@@ src/chage.c: static void close_files (void)
    +@@ src/chage.c: static void close_files (struct option_flags *flags)
    @@ src/chage.c: static void close_files (void)
    - 	if (pw_close () == 0) {
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/chage.c: static void close_files (void)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: static void close_files (void)
    - 	if (spw_unlock () == 0) {
    + 	if (spw_unlock (process_selinux) == 0) {
    @@ src/chage.c: static void close_files (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/chage.c: static void update_age (/*@null@*/const struct spwd *sp,
    - 			fail_exit (E_NOPERM);
    + 			fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: static void update_age (/*@null@*/const struct spwd *sp,
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: int main (int argc, char **argv)
    - 	check_perms ();
    + 	check_perms (&flags);
    @@ src/chage.c: int main (int argc, char **argv)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: int main (int argc, char **argv)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: int main (int argc, char **argv)
    - 			fail_exit (E_NOPERM);
    + 			fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: int main (int argc, char **argv)
    - 			fail_exit (E_NOPERM);
    + 			fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c
    -@@ src/chfn.c: static void fail_exit (int code)
    +@@ src/chfn.c: static void fail_exit (int code, bool process_selinux)
    @@ src/chfn.c: static void fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/chfn.c: static void fail_exit (int code)
    -@@ src/chfn.c: static void process_flags (int argc, char **argv)
    +@@ src/chfn.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chfn.c: static void process_flags (int argc, char **argv)
    -@@ src/chfn.c: static void process_flags (int argc, char **argv)
    +@@ src/chfn.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chfn.c: static void process_flags (int argc, char **argv)
    -@@ src/chfn.c: static void process_flags (int argc, char **argv)
    +@@ src/chfn.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chfn.c: static void process_flags (int argc, char **argv)
    -@@ src/chfn.c: static void process_flags (int argc, char **argv)
    +@@ src/chfn.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chfn.c: static void check_perms (const struct passwd *pw)
    -@@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    +@@ src/chfn.c: static void update_gecos (const char *user, char *gecos, struct option_flags *fl
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    -@@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    +@@ src/chfn.c: static void update_gecos (const char *user, char *gecos, struct option_flags *fl
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    -@@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    +@@ src/chfn.c: static void update_gecos (const char *user, char *gecos, struct option_flags *fl
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    -@@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    +@@ src/chfn.c: static void update_gecos (const char *user, char *gecos, struct option_flags *fl
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    - 	if (pw_close () == 0) {
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    -@@ src/chfn.c: static void check_fields (void)
    +@@ src/chfn.c: static void check_fields (bool process_selinux)
    @@ src/chfn.c: static void check_fields (void)
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: static void check_fields (void)
    - 		fail_exit (E_NOPERM);
    @@ src/chfn.c: static void check_fields (void)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: static void check_fields (void)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: static void check_fields (void)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: static void check_fields (void)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: int main (int argc, char **argv)
    - 			fail_exit (E_NOPERM);
    + 			fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: int main (int argc, char **argv)
    - 			fail_exit (E_NOPERM);
    + 			fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: int main (int argc, char **argv)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chgpasswd.c
    -@@ src/chgpasswd.c: static void fail_exit (int code)
    +@@ src/chgpasswd.c: static void fail_exit (int code, bool process_selinux)
    @@ src/chgpasswd.c: static void fail_exit (int code)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/chgpasswd.c: static void fail_exit (int code)
    -@@ src/chgpasswd.c: static void fail_exit (int code)
    +@@ src/chgpasswd.c: static void fail_exit (int code, bool process_selinux)
    @@ src/chgpasswd.c: static void fail_exit (int code)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/chgpasswd.c: static void fail_exit (int code)
    -@@ src/chgpasswd.c: static void process_flags (int argc, char **argv)
    +@@ src/chgpasswd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chgpasswd.c: static void process_flags (int argc, char **argv)
    -@@ src/chgpasswd.c: static void process_flags (int argc, char **argv)
    +@@ src/chgpasswd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chgpasswd.c: static void check_perms (void)
    -@@ src/chgpasswd.c: static void open_files (void)
    +@@ src/chgpasswd.c: static void open_files (bool process_selinux)
    @@ src/chgpasswd.c: static void open_files (void)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chgpasswd.c: static void open_files (void)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chgpasswd.c: static void open_files (void)
    -@@ src/chgpasswd.c: static void open_files (void)
    +@@ src/chgpasswd.c: static void open_files (bool process_selinux)
    @@ src/chgpasswd.c: static void open_files (void)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/chgpasswd.c: static void open_files (void)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/chgpasswd.c: static void open_files (void)
    -@@ src/chgpasswd.c: static void close_files (void)
    +@@ src/chgpasswd.c: static void close_files (struct option_flags *flags)
    @@ src/chgpasswd.c: static void close_files (void)
    - 		if (sgr_close () == 0) {
    + 		if (sgr_close (process_selinux) == 0) {
    @@ src/chgpasswd.c: static void close_files (void)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/chgpasswd.c: static void close_files (void)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/chgpasswd.c: static void close_files (void)
    -@@ src/chgpasswd.c: static void close_files (void)
    +@@ src/chgpasswd.c: static void close_files (struct option_flags *flags)
    @@ src/chgpasswd.c: static void close_files (void)
    - 	if (gr_close () == 0) {
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/chgpasswd.c: static void close_files (void)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chgpasswd.c: static void close_files (void)
    - 	if (gr_unlock () == 0) {
    + 	if (gr_unlock (process_selinux) == 0) {
    @@ src/chgpasswd.c: int main (int argc, char **argv)
    - 				fail_exit (1);
    + 				fail_exit (1, process_selinux);
    @@ src/chgpasswd.c: int main (int argc, char **argv)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chpasswd.c
    -@@ src/chpasswd.c: static void fail_exit (int code)
    +@@ src/chpasswd.c: static void fail_exit (int code, bool process_selinux)
    @@ src/chpasswd.c: static void fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/chpasswd.c: static void fail_exit (int code)
    -@@ src/chpasswd.c: static void fail_exit (int code)
    +@@ src/chpasswd.c: static void fail_exit (int code, bool process_selinux)
    @@ src/chpasswd.c: static void fail_exit (int code)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/chpasswd.c: static void fail_exit (int code)
    -@@ src/chpasswd.c: static void process_flags (int argc, char **argv)
    +@@ src/chpasswd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/chpasswd.c: static void check_perms (void)
    -@@ src/chpasswd.c: static void open_files (void)
    +@@ src/chpasswd.c: static void open_files (struct option_flags *flags)
    @@ src/chpasswd.c: static void open_files (void)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chpasswd.c: static void open_files (void)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chpasswd.c: static void open_files (void)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/chpasswd.c: static void open_files (void)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/chpasswd.c: static void open_files (void)
    -@@ src/chpasswd.c: static void close_files (void)
    - {
    +@@ src/chpasswd.c: static void close_files (struct option_flags *flags)
    + 
    @@ src/chpasswd.c: static void close_files (void)
    - 		if (spw_close () == 0) {
    + 		if (spw_close (process_selinux) == 0) {
    @@ src/chpasswd.c: static void close_files (void)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/chpasswd.c: static void close_files (void)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/chpasswd.c: static void close_files (void)
    -@@ src/chpasswd.c: static void close_files (void)
    +@@ src/chpasswd.c: static void close_files (struct option_flags *flags)
    @@ src/chpasswd.c: static void close_files (void)
    - 	if (pw_close () == 0) {
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/chpasswd.c: static void close_files (void)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chpasswd.c: static void close_files (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/chpasswd.c: int main (int argc, char **argv)
    - 				fail_exit (1);
    + 				fail_exit (1, process_selinux);
    @@ src/chpasswd.c: int main (int argc, char **argv)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c
    -@@ src/chsh.c: fail_exit (int code)
    +@@ src/chsh.c: fail_exit (int code, bool process_selinux)
    @@ src/chsh.c: fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/chsh.c: static bool shell_is_listed (const char *sh)
    -@@ src/chsh.c: static void check_perms (const struct passwd *pw)
    +@@ src/chsh.c: static void check_perms (const struct passwd *pw, struct option_flags *flags)
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    -@@ src/chsh.c: static void check_perms (const struct passwd *pw)
    +@@ src/chsh.c: static void check_perms (const struct passwd *pw, struct option_flags *flags)
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    -@@ src/chsh.c: static void check_perms (const struct passwd *pw)
    +@@ src/chsh.c: static void check_perms (const struct passwd *pw, struct option_flags *flags)
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    -@@ src/chsh.c: static void check_perms (const struct passwd *pw)
    +@@ src/chsh.c: static void check_perms (const struct passwd *pw, struct option_flags *flags)
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    -@@ src/chsh.c: static void check_perms (const struct passwd *pw)
    +@@ src/chsh.c: static void check_perms (const struct passwd *pw, struct option_flags *flags)
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    -@@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    +@@ src/chsh.c: static void update_shell (const char *user, char *newshell, struct option_flags
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    -@@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    +@@ src/chsh.c: static void update_shell (const char *user, char *newshell, struct option_flags
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    -@@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    +@@ src/chsh.c: static void update_shell (const char *user, char *newshell, struct option_flags
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    -@@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    +@@ src/chsh.c: static void update_shell (const char *user, char *newshell, struct option_flags
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    - 	if (pw_close () == 0) {
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/chsh.c: int main (int argc, char **argv)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/chsh.c: int main (int argc, char **argv)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/chsh.c: int main (int argc, char **argv)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: int main (int argc, char **argv)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/gpasswd.c: static bool is_valid_user_list (const char *users)
    -@@ src/gpasswd.c: static void process_flags (int argc, char **argv)
    +@@ src/gpasswd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/gpasswd.c: static void process_flags (int argc, char **argv)
    -@@ src/gpasswd.c: static void process_flags (int argc, char **argv)
    +@@ src/gpasswd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/gpasswd.c: static void open_files (void)
    -@@ src/gpasswd.c: static void log_gpasswd_success_group (MAYBE_UNUSED void *arg)
    - static void close_files (void)
    - {
    - 	if (gr_close () == 0) {
    +@@ src/gpasswd.c: static void close_files (struct option_flags *flags)
    + 	process_selinux = !flags->chroot;
    + 
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/gpasswd.c: static void log_gpasswd_success_group (MAYBE_UNUSED void *arg)
    -@@ src/gpasswd.c: static void close_files (void)
    +@@ src/gpasswd.c: static void close_files (struct option_flags *flags)
    @@ src/gpasswd.c: static void close_files (void)
    - 		if (sgr_close () == 0) {
    + 		if (sgr_close (process_selinux) == 0) {
    @@ src/gpasswd.c: static void update_group (struct group *gr)
    -@@ src/gpasswd.c: static void get_group (struct group *gr)
    - #endif
    +@@ src/gpasswd.c: static void get_group (struct group *gr, struct option_flags *flags)
    + 	process_selinux = !flags->chroot;
    @@ src/gpasswd.c: static void get_group (struct group *gr)
    -@@ src/gpasswd.c: static void get_group (struct group *gr)
    +@@ src/gpasswd.c: static void get_group (struct group *gr, struct option_flags *flags)
    @@ src/gpasswd.c: static void get_group (struct group *gr)
    - 	if (gr_close () == 0) {
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/gpasswd.c: static void get_group (struct group *gr)
    -@@ src/gpasswd.c: static void get_group (struct group *gr)
    +@@ src/gpasswd.c: static void get_group (struct group *gr, struct option_flags *flags)
    @@ src/gpasswd.c: static void get_group (struct group *gr)
    -@@ src/gpasswd.c: static void get_group (struct group *gr)
    +@@ src/gpasswd.c: static void get_group (struct group *gr, struct option_flags *flags)
    @@ src/gpasswd.c: static void get_group (struct group *gr)
    - 		if (sgr_close () == 0) {
    + 		if (sgr_close (process_selinux) == 0) {
    @@ src/groupadd.c: static void
    -@@ src/groupadd.c: static void close_files (void)
    - {
    +@@ src/groupadd.c: static void close_files (struct option_flags *flags)
    + 
    @@ src/groupadd.c: static void close_files (void)
    - 	if (gr_close () == 0) {
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/groupadd.c: static void close_files (void)
    -@@ src/groupadd.c: static void close_files (void)
    +@@ src/groupadd.c: static void close_files (struct option_flags *flags)
    @@ src/groupadd.c: static void close_files (void)
    - 		if (sgr_close () == 0) {
    + 		if (sgr_close (process_selinux) == 0) {
    @@ src/groupadd.c: static void close_files (void)
    -@@ src/groupadd.c: static void open_files (void)
    - {
    +@@ src/groupadd.c: static void open_files (struct option_flags *flags)
    + 
    @@ src/groupadd.c: static void open_files (void)
    -@@ src/groupadd.c: static void open_files (void)
    +@@ src/groupadd.c: static void open_files (struct option_flags *flags)
    @@ src/groupadd.c: static void open_files (void)
    -@@ src/groupadd.c: static void open_files (void)
    +@@ src/groupadd.c: static void open_files (struct option_flags *flags)
    @@ src/groupadd.c: static void open_files (void)
    -@@ src/groupadd.c: static void open_files (void)
    +@@ src/groupadd.c: static void open_files (struct option_flags *flags)
    @@ src/groupadd.c: static void open_files (void)
    -@@ src/groupadd.c: static void process_flags (int argc, char **argv)
    +@@ src/groupadd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/groupadd.c: static void process_flags (int argc, char **argv)
    -@@ src/groupadd.c: static void process_flags (int argc, char **argv)
    +@@ src/groupadd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/groupdel.c: static void grp_update (void)
    -@@ src/groupdel.c: static void close_files (void)
    - {
    +@@ src/groupdel.c: static void close_files (struct option_flags *flags)
    + 
    @@ src/groupdel.c: static void close_files (void)
    - 	if (gr_close () == 0) {
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/groupdel.c: static void close_files (void)
    -@@ src/groupdel.c: static void close_files (void)
    +@@ src/groupdel.c: static void close_files (struct option_flags *flags)
    @@ src/groupdel.c: static void close_files (void)
    - 		if (sgr_close () == 0) {
    + 		if (sgr_close (process_selinux) == 0) {
    @@ src/groupdel.c: static void close_files (void)
    -@@ src/groupdel.c: static void open_files (void)
    - {
    +@@ src/groupdel.c: static void open_files (struct option_flags *flags)
    + 
    @@ src/groupdel.c: static void open_files (void)
    -@@ src/groupdel.c: static void open_files (void)
    +@@ src/groupdel.c: static void open_files (struct option_flags *flags)
    @@ src/groupdel.c: static void open_files (void)
    -@@ src/groupdel.c: static void open_files (void)
    +@@ src/groupdel.c: static void open_files (struct option_flags *flags)
    @@ src/groupmems.c: static void add_user (const char *user,
    - 		fail_exit (EXIT_MEMBER_EXISTS);
    + 		fail_exit (EXIT_MEMBER_EXISTS, process_selinux);
    @@ src/groupmems.c: static void add_user (const char *user,
    - 		fail_exit (13);
    + 		fail_exit (13, process_selinux);
    @@ src/groupmems.c: static void add_user (const char *user,
    - 				fail_exit (13);
    + 				fail_exit (13, process_selinux);
    @@ src/groupmems.c: static void add_user (const char *user,
    - 			fail_exit (13);
    + 			fail_exit (13, process_selinux);
    @@ src/groupmems.c: static void add_user (const char *user,
    - 		fail_exit (13);
    + 		fail_exit (13, process_selinux);
    @@ src/groupmems.c: static void remove_user (const char *user,
    - 		fail_exit (EXIT_NOT_MEMBER);
    + 		fail_exit (EXIT_NOT_MEMBER, process_selinux);
    @@ src/groupmems.c: static void remove_user (const char *user,
    - 		fail_exit (13);
    + 		fail_exit (13, process_selinux);
    @@ src/groupmems.c: static void remove_user (const char *user,
    - 				fail_exit (13);
    + 				fail_exit (13, process_selinux);
    @@ src/groupmems.c: static void remove_user (const char *user,
    - 			fail_exit (13);
    + 			fail_exit (13, process_selinux);
    @@ src/groupmems.c: static void remove_user (const char *user,
    - 		fail_exit (13);
    + 		fail_exit (13, process_selinux);
    @@ src/groupmems.c: static void remove_user (const char *user,
    -@@ src/groupmems.c: static void purge_members (const struct group *grp)
    +@@ src/groupmems.c: static void purge_members (const struct group *grp, bool process_selinux)
    @@ src/groupmems.c: static void purge_members (const struct group *grp)
    - 		fail_exit (13);
    + 		fail_exit (13, process_selinux);
    @@ src/groupmems.c: static void purge_members (const struct group *grp)
    -@@ src/groupmems.c: static void purge_members (const struct group *grp)
    +@@ src/groupmems.c: static void purge_members (const struct group *grp, bool process_selinux)
    @@ src/groupmems.c: static void purge_members (const struct group *grp)
    - 				fail_exit (13);
    + 				fail_exit (13, process_selinux);
    @@ src/groupmems.c: static void purge_members (const struct group *grp)
    -@@ src/groupmems.c: static void purge_members (const struct group *grp)
    +@@ src/groupmems.c: static void purge_members (const struct group *grp, bool process_selinux)
    @@ src/groupmems.c: static void purge_members (const struct group *grp)
    - 			fail_exit (13);
    + 			fail_exit (13, process_selinux);
    @@ src/groupmems.c: static void purge_members (const struct group *grp)
    -@@ src/groupmems.c: static void purge_members (const struct group *grp)
    +@@ src/groupmems.c: static void purge_members (const struct group *grp, bool process_selinux)
    @@ src/groupmems.c: static void purge_members (const struct group *grp)
    - 		fail_exit (13);
    + 		fail_exit (13, process_selinux);
    @@ src/groupmems.c: static void purge_members (const struct group *grp)
    -@@ src/groupmems.c: static void process_flags (int argc, char **argv)
    +@@ src/groupmems.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/groupmems.c: static void process_flags (int argc, char **argv)
    - 		fail_exit (EXIT_INVALID_USER);
    + 		fail_exit (EXIT_INVALID_USER, !flags->chroot);
    @@ src/groupmems.c: static void process_flags (int argc, char **argv)
    -@@ src/groupmems.c: static void check_perms (void)
    +@@ src/groupmems.c: static void check_perms (bool process_selinux)
    @@ src/groupmems.c: static void check_perms (void)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/groupmems.c: static void check_perms (void)
    -@@ src/groupmems.c: static void check_perms (void)
    +@@ src/groupmems.c: static void check_perms (bool process_selinux)
    @@ src/groupmems.c: static void check_perms (void)
    -@@ src/groupmems.c: static void fail_exit (int code)
    +@@ src/groupmems.c: static void fail_exit (int code, bool process_selinux)
    @@ src/groupmems.c: static void fail_exit (int code)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/groupmems.c: static void fail_exit (int code)
    -@@ src/groupmems.c: static void fail_exit (int code)
    +@@ src/groupmems.c: static void fail_exit (int code, bool process_selinux)
    @@ src/groupmems.c: static void fail_exit (int code)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/groupmems.c: static void fail_exit (int code)
    -@@ src/groupmems.c: static void open_files (void)
    +@@ src/groupmems.c: static void open_files (bool process_selinux)
    @@ src/groupmems.c: static void open_files (void)
    - 			fail_exit (EXIT_GROUP_FILE);
    + 			fail_exit (EXIT_GROUP_FILE, process_selinux);
    @@ src/groupmems.c: static void open_files (void)
    -@@ src/groupmems.c: static void open_files (void)
    +@@ src/groupmems.c: static void open_files (bool process_selinux)
    @@ src/groupmems.c: static void open_files (void)
    - 				fail_exit (EXIT_GROUP_FILE);
    + 				fail_exit (EXIT_GROUP_FILE, process_selinux);
    @@ src/groupmems.c: static void open_files (void)
    -@@ src/groupmems.c: static void open_files (void)
    +@@ src/groupmems.c: static void open_files (bool process_selinux)
    @@ src/groupmems.c: static void open_files (void)
    - 		fail_exit (EXIT_GROUP_FILE);
    + 		fail_exit (EXIT_GROUP_FILE, process_selinux);
    @@ src/groupmems.c: static void open_files (void)
    - 			fail_exit (EXIT_GROUP_FILE);
    + 			fail_exit (EXIT_GROUP_FILE, process_selinux);
    @@ src/groupmems.c: static void open_files (void)
    -@@ src/groupmems.c: static void open_files (void)
    - static void close_files (void)
    - {
    - 	if ((gr_close () == 0) && !list) {
    +@@ src/groupmems.c: static void close_files (struct option_flags *flags)
    + 	process_selinux = !flags->chroot;
    + 
    + 	if ((gr_close (process_selinux) == 0) && !list) {
    @@ src/groupmems.c: static void open_files (void)
    - 		fail_exit (EXIT_GROUP_FILE);
    + 		fail_exit (EXIT_GROUP_FILE, process_selinux);
    @@ src/groupmems.c: static void open_files (void)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/groupmems.c: static void open_files (void)
    -@@ src/groupmems.c: static void close_files (void)
    +@@ src/groupmems.c: static void close_files (struct option_flags *flags)
    @@ src/groupmems.c: static void close_files (void)
    - 		if ((sgr_close () == 0) && !list) {
    + 		if ((sgr_close (process_selinux) == 0) && !list) {
    @@ src/groupmems.c: static void close_files (void)
    - 			fail_exit (EXIT_GROUP_FILE);
    + 			fail_exit (EXIT_GROUP_FILE, process_selinux);
    @@ src/groupmems.c: static void close_files (void)
    - 			if (sgr_unlock () == 0) {
    + 			if (sgr_unlock (process_selinux) == 0) {
    @@ src/groupmems.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_NOT_PRIMARY);
    + 			fail_exit (EXIT_NOT_PRIMARY, process_selinux);
    @@ src/groupmems.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_NOT_ROOT);
    + 			fail_exit (EXIT_NOT_ROOT, process_selinux);
    @@ src/groupmems.c: int main (int argc, char **argv)
    - 		fail_exit (EXIT_INVALID_GROUP);
    + 		fail_exit (EXIT_INVALID_GROUP, process_selinux);
    @@ src/groupmod.c: check_new_name(void)
    -@@ src/groupmod.c: static void process_flags (int argc, char **argv)
    +@@ src/groupmod.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/groupmod.c: static void process_flags (int argc, char **argv)
    -@@ src/groupmod.c: static void process_flags (int argc, char **argv)
    - static void close_files (void)
    - {
    - 	if (gr_close () == 0) {
    +@@ src/groupmod.c: static void close_files (struct option_flags *flags)
    + 	process_selinux = !flags->chroot && !flags->prefix;
    + 
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/groupmod.c: static void process_flags (int argc, char **argv)
    -@@ src/groupmod.c: static void close_files (void)
    +@@ src/groupmod.c: static void close_files (struct option_flags *flags)
    @@ src/groupmod.c: static void close_files (void)
    - 		if (sgr_close () == 0) {
    + 		if (sgr_close (process_selinux) == 0) {
    @@ src/groupmod.c: static void close_files (void)
    -@@ src/groupmod.c: static void close_files (void)
    +@@ src/groupmod.c: static void close_files (struct option_flags *flags)
    @@ src/groupmod.c: static void close_files (void)
    - 		if (pw_close () == 0) {
    + 		if (pw_close (process_selinux) == 0) {
    @@ src/groupmod.c: static void close_files (void)
    -@@ src/groupmod.c: static void prepare_failure_reports (void)
    - static void lock_files (void)
    - {
    +@@ src/groupmod.c: static void lock_files (struct option_flags *flags)
    + 	process_selinux = !flags->chroot && !flags->prefix;
    + 
    @@ src/groupmod.c: static void prepare_failure_reports (void)
    -@@ src/groupmod.c: static void lock_files (void)
    +@@ src/groupmod.c: static void lock_files (struct option_flags *flags)
    @@ src/groupmod.c: static void lock_files (void)
    -@@ src/groupmod.c: static void lock_files (void)
    +@@ src/groupmod.c: static void lock_files (struct option_flags *flags)
    @@ src/groupmod.c: static void lock_files (void)
    -@@ src/groupmod.c: static void lock_files (void)
    +@@ src/groupmod.c: static void lock_files (struct option_flags *flags)
    @@ src/grpck.c
    - #include "shadowlog.h"
    -@@ src/grpck.c: static void fail_exit (int status)
    + #include "shadow/gshadow/gshadow.h"
    +@@ src/grpck.c: static void fail_exit (int status, bool process_selinux)
    @@ src/grpck.c: static void fail_exit (int status)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/grpck.c: static void fail_exit (int status)
    -@@ src/grpck.c: static void fail_exit (int status)
    +@@ src/grpck.c: static void fail_exit (int status, bool process_selinux)
    @@ src/grpck.c: static void fail_exit (int status)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/grpck.c: static void fail_exit (int status)
    -@@ src/grpck.c: static void process_flags (int argc, char **argv)
    +@@ src/grpck.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/grpck.c: static void process_flags (int argc, char **argv)
    -@@ src/grpck.c: static void open_files (void)
    +@@ src/grpck.c: static void open_files (bool process_selinux)
    @@ src/grpck.c: static void open_files (void)
    - 			fail_exit (E_CANT_LOCK);
    + 			fail_exit (E_CANT_LOCK, process_selinux);
    @@ src/grpck.c: static void open_files (void)
    -@@ src/grpck.c: static void open_files (void)
    +@@ src/grpck.c: static void open_files (bool process_selinux)
    @@ src/grpck.c: static void open_files (void)
    - 				fail_exit (E_CANT_LOCK);
    + 				fail_exit (E_CANT_LOCK, process_selinux);
    @@ src/grpck.c: static void open_files (void)
    -@@ src/grpck.c: static void open_files (void)
    +@@ src/grpck.c: static void open_files (bool process_selinux)
    @@ src/grpck.c: static void open_files (void)
    -@@ src/grpck.c: static void open_files (void)
    +@@ src/grpck.c: static void open_files (bool process_selinux)
    @@ src/grpck.c: static void open_files (void)
    -@@ src/grpck.c: static void close_files (bool changed)
    +@@ src/grpck.c: static void close_files (bool changed, struct option_flags *flags)
    @@ src/grpck.c: static void close_files (bool changed)
    - 		if (gr_close () == 0) {
    + 		if (gr_close (process_selinux) == 0) {
    @@ src/grpck.c: static void close_files (bool changed)
    - 			fail_exit (E_CANT_UPDATE);
    + 			fail_exit (E_CANT_UPDATE, process_selinux);
    @@ src/grpck.c: static void close_files (bool changed)
    - 		if (is_shadow && (sgr_close () == 0)) {
    + 		if (is_shadow && (sgr_close (process_selinux) == 0)) {
    @@ src/grpck.c: static void close_files (bool changed)
    - 			fail_exit (E_CANT_UPDATE);
    + 			fail_exit (E_CANT_UPDATE, process_selinux);
    @@ src/grpck.c: static void close_files (bool changed)
    -@@ src/grpck.c: static void close_files (bool changed)
    +@@ src/grpck.c: static void close_files (bool changed, struct option_flags *flags)
    @@ src/grpck.c: static void close_files (bool changed)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/grpck.c: static void close_files (bool changed)
    -@@ src/grpck.c: static void close_files (bool changed)
    +@@ src/grpck.c: static void close_files (bool changed, struct option_flags *flags)
    @@ src/grpck.c: static void close_files (bool changed)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/grpck.c: static void close_files (bool changed)
    -@@ src/grpck.c: static void check_grp_file (bool *errors, bool *changed)
    +@@ src/grpck.c: static void check_grp_file (bool *errors, bool *changed, struct option_flags *fl
    @@ src/grpck.c: static void check_grp_file (bool *errors, bool *changed)
    - 						fail_exit (E_CANT_UPDATE);
    + 						fail_exit (E_CANT_UPDATE, process_selinux);
    @@ src/grpck.c: static void check_grp_file (bool *errors, bool *changed)
    -@@ src/grpck.c: static void check_grp_file (bool *errors, bool *changed)
    +@@ src/grpck.c: static void check_grp_file (bool *errors, bool *changed, struct option_flags *fl
    @@ src/grpck.c: static void check_grp_file (bool *errors, bool *changed)
    - 						fail_exit (E_CANT_UPDATE);
    + 						fail_exit (E_CANT_UPDATE, process_selinux);
    @@ src/grpconv.c
    -@@ src/grpconv.c: static void fail_exit (int status)
    +@@ src/grpconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/grpconv.c: static void fail_exit (int status)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/grpconv.c: static void fail_exit (int status)
    -@@ src/grpconv.c: static void fail_exit (int status)
    +@@ src/grpconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/grpconv.c: static void fail_exit (int status)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 	process_flags (argc, argv);
    + 	process_selinux = !flags.chroot;
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 		fail_exit (5);
    + 		fail_exit (5, process_selinux);
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 		fail_exit (5);
    + 		fail_exit (5, process_selinux);
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 			fail_exit (3);
    + 			fail_exit (3, process_selinux);
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 			fail_exit (3);
    + 			fail_exit (3, process_selinux);
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 			fail_exit (3);
    + 			fail_exit (3, process_selinux);
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 	if (sgr_close () == 0) {
    + 	if (sgr_close (process_selinux) == 0) {
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 		fail_exit (3);
    + 		fail_exit (3, process_selinux);
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 	if (gr_close () == 0) {
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 		fail_exit (3);
    + 		fail_exit (3, process_selinux);
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 	if (sgr_unlock () == 0) {
    + 	if (sgr_unlock (process_selinux) == 0) {
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 	if (gr_unlock () == 0) {
    + 	if (gr_unlock (process_selinux) == 0) {
    @@ src/grpunconv.c
    -@@ src/grpunconv.c: static void fail_exit (int status)
    +@@ src/grpunconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/grpunconv.c: static void fail_exit (int status)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/grpunconv.c: static void fail_exit (int status)
    -@@ src/grpunconv.c: static void fail_exit (int status)
    +@@ src/grpunconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/grpunconv.c: static void fail_exit (int status)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 		fail_exit (5);
    + 		fail_exit (5, process_selinux);
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 		fail_exit (5);
    + 		fail_exit (5, process_selinux);
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 				fail_exit (3);
    + 				fail_exit (3, process_selinux);
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 	(void) sgr_close (); /* was only open O_RDONLY */
    + 	(void) sgr_close (process_selinux); /* was only open O_RDONLY */
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 	if (gr_close () == 0) {
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 		fail_exit (3);
    + 		fail_exit (3, process_selinux);
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 	if (unlink (SGROUP_FILE) != 0) {
    + 	if (unlink(_PATH_GSHADOW) != 0) {
    @@ src/grpunconv.c: int main (int argc, char **argv)
    --		         Prog, SGROUP_FILE);
    -+		eprintf(_("%s: cannot delete %s\n"), Prog, SGROUP_FILE);
    - 		SYSLOG ((LOG_ERR, "cannot delete %s", SGROUP_FILE));
    - 		fail_exit (3);
    +-		         Prog, _PATH_GSHADOW);
    ++		eprintf(_("%s: cannot delete %s\n"), Prog, _PATH_GSHADOW);
    + 		SYSLOG((LOG_ERR, "cannot delete %s", _PATH_GSHADOW));
    + 		fail_exit (3, process_selinux);
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 	if (gr_unlock () == 0) {
    + 	if (gr_unlock (process_selinux) == 0) {
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 	if (sgr_unlock () == 0) {
    + 	if (sgr_unlock (process_selinux) == 0) {
    @@ src/login.c
    - #include "shadowlog.h"
    + #include "shadow/gshadow/endsgent.h"
    @@ src/newusers.c
    -@@ src/newusers.c: static void fail_exit (int code)
    +@@ src/newusers.c: static void fail_exit (int code, bool process_selinux)
    @@ src/newusers.c: static void fail_exit (int code)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void fail_exit (int code)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void fail_exit (int code)
    -@@ src/newusers.c: static void fail_exit (int code)
    +@@ src/newusers.c: static void fail_exit (int code, bool process_selinux)
    @@ src/newusers.c: static void fail_exit (int code)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void fail_exit (int code)
    -@@ src/newusers.c: static void fail_exit (int code)
    +@@ src/newusers.c: static void fail_exit (int code, bool process_selinux)
    @@ src/newusers.c: static void fail_exit (int code)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void fail_exit (int code)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static int add_passwd (struct passwd *pwd, const char *password)
    -@@ src/newusers.c: static void process_flags (int argc, char **argv)
    +@@ src/newusers.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/newusers.c: static void process_flags (int argc, char **argv)
    -@@ src/newusers.c: static void process_flags (int argc, char **argv)
    +@@ src/newusers.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/newusers.c: static void check_flags (void)
    -@@ src/newusers.c: static void check_perms (void)
    +@@ src/newusers.c: static void check_perms (struct option_flags *flags)
    @@ src/newusers.c: static void check_perms (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void check_perms (void)
    -@@ src/newusers.c: static void check_perms (void)
    +@@ src/newusers.c: static void check_perms (struct option_flags *flags)
    @@ src/newusers.c: static void check_perms (void)
    -@@ src/newusers.c: static void open_files (void)
    +@@ src/newusers.c: static void open_files (bool process_selinux)
    @@ src/newusers.c: static void open_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    -@@ src/newusers.c: static void open_files (void)
    +@@ src/newusers.c: static void open_files (bool process_selinux)
    @@ src/newusers.c: static void open_files (void)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    -@@ src/newusers.c: static void open_files (void)
    +@@ src/newusers.c: static void open_files (bool process_selinux)
    @@ src/newusers.c: static void open_files (void)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    -@@ src/newusers.c: static void open_files (void)
    +@@ src/newusers.c: static void open_files (bool process_selinux)
    @@ src/newusers.c: static void open_files (void)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    -@@ src/newusers.c: static void open_files (void)
    +@@ src/newusers.c: static void open_files (bool process_selinux)
    @@ src/newusers.c: static void open_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    -@@ src/newusers.c: static void open_files (void)
    - static void close_files (void)
    - {
    - 	if (pw_close () == 0) {
    +@@ src/newusers.c: static void close_files (struct option_flags *flags)
    + 	process_selinux = !flags->chroot;
    + 
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/newusers.c: static void open_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void open_files (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void open_files (void)
    -@@ src/newusers.c: static void close_files (void)
    +@@ src/newusers.c: static void close_files (struct option_flags *flags)
    @@ src/newusers.c: static void close_files (void)
    - 		if (spw_close () == 0) {
    + 		if (spw_close (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void close_files (void)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    -@@ src/newusers.c: static void close_files (void)
    +@@ src/newusers.c: static void close_files (struct option_flags *flags)
    @@ src/newusers.c: static void close_files (void)
    - 	if (gr_close () == 0) {
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void close_files (void)
    - 	if (is_sub_uid  && (sub_uid_close () == 0)) {
    + 	if (is_sub_uid  && (sub_uid_close (process_selinux) == 0)) {
    @@ src/newusers.c: static void close_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void close_files (void)
    - 	if (is_sub_gid  && (sub_gid_close () == 0)) {
    + 	if (is_sub_gid  && (sub_gid_close (process_selinux) == 0)) {
    @@ src/newusers.c: static void close_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void close_files (void)
    - 	if (gr_unlock () == 0) {
    + 	if (gr_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    -@@ src/newusers.c: static void close_files (void)
    +@@ src/newusers.c: static void close_files (struct option_flags *flags)
    @@ src/newusers.c: static void close_files (void)
    - 		if (sgr_close () == 0) {
    + 		if (sgr_close (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void close_files (void)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    -@@ src/newusers.c: static void close_files (void)
    +@@ src/newusers.c: static void close_files (struct option_flags *flags)
    @@ src/newusers.c: static void close_files (void)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    -@@ src/newusers.c: static void close_files (void)
    +@@ src/newusers.c: static void close_files (struct option_flags *flags)
    @@ src/newusers.c: static void close_files (void)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/newusers.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 				fail_exit (EXIT_FAILURE);
    + 				fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 				fail_exit (EXIT_FAILURE);
    + 				fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 				fail_exit (EXIT_FAILURE);
    + 				fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 				fail_exit (EXIT_FAILURE);
    + 				fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 				fail_exit (EXIT_FAILURE);
    + 				fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 				fail_exit (EXIT_FAILURE);
    + 				fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/passwd.c: static void print_status (const struct passwd *pw)
    -@@ src/passwd.c: fail_exit (int status)
    +@@ src/passwd.c: fail_exit (int status, bool process_selinux)
    @@ src/passwd.c: fail_exit (int status)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/passwd.c: fail_exit (int status)
    -+			(void) eprintf(_("%s: failed to unlock %s\n"), Prog, pw_dbname());
    ++			eprintf(_("%s: failed to unlock %s\n"), Prog, pw_dbname());
    @@ src/passwd.c: fail_exit (int status)
    -@@ src/passwd.c: fail_exit (int status)
    +@@ src/passwd.c: fail_exit (int status, bool process_selinux)
    @@ src/passwd.c: fail_exit (int status)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/passwd.c: fail_exit (int status)
    -+			(void) eprintf(_("%s: failed to unlock %s\n"), Prog, spw_dbname());
    ++			eprintf(_("%s: failed to unlock %s\n"), Prog, spw_dbname());
    @@ src/passwd.c: NORETURN
    - oom (void)
    + oom (bool process_selinux)
    @@ src/passwd.c: NORETURN
    -+	(void) eprintf(_("%s: out of memory\n"), Prog);
    - 	fail_exit (E_FAILURE);
    ++	eprintf(_("%s: out of memory\n"), Prog);
    + 	fail_exit (E_FAILURE, process_selinux);
    @@ src/passwd.c: NORETURN
    -@@ src/passwd.c: static char *update_crypt_pw (char *cp)
    +@@ src/passwd.c: static char *update_crypt_pw (char *cp, bool process_selinux)
    @@ src/passwd.c: static char *update_crypt_pw (char *cp)
    - 			fail_exit (E_FAILURE);
    + 			fail_exit (E_FAILURE, process_selinux);
    @@ src/passwd.c: static char *update_crypt_pw (char *cp)
    -@@ src/passwd.c: static void update_noshadow (void)
    - 	struct passwd *npw;
    +@@ src/passwd.c: static void update_noshadow (struct option_flags *flags)
    + 	process_selinux = !flags->chroot && !flags->prefix;
    @@ src/passwd.c: static void update_noshadow (void)
    - 		fail_exit (E_MISSING);
    + 		fail_exit (E_MISSING, process_selinux);
    @@ src/passwd.c: static void update_noshadow (void)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/passwd.c: static void update_noshadow (void)
    -@@ src/passwd.c: static void update_noshadow (void)
    +@@ src/passwd.c: static void update_noshadow (struct option_flags *flags)
    @@ src/passwd.c: static void update_noshadow (void)
    - 	npw->pw_passwd = update_crypt_pw (npw->pw_passwd);
    + 	npw->pw_passwd = update_crypt_pw (npw->pw_passwd, process_selinux);
    @@ src/passwd.c: static void update_noshadow (void)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/passwd.c: static void update_noshadow (void)
    - 	if (pw_close () == 0) {
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/passwd.c: static void update_noshadow (void)
    -+		(void) eprintf(_("%s: failure while writing changes to %s\n"),
    ++		eprintf(_("%s: failure while writing changes to %s\n"),
    @@ src/passwd.c: static void update_noshadow (void)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/passwd.c: static void update_noshadow (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/passwd.c: static void update_noshadow (void)
    -+		(void) eprintf(_("%s: failed to unlock %s\n"), Prog, pw_dbname());
    ++		eprintf(_("%s: failed to unlock %s\n"), Prog, pw_dbname());
    @@ src/passwd.c: static void update_noshadow (void)
    -@@ src/passwd.c: static void update_shadow (void)
    - 	struct spwd *nsp;
    +@@ src/passwd.c: static void update_shadow (struct option_flags *flags)
    + 	process_selinux = !flags->chroot && !flags->prefix;
    @@ src/passwd.c: static void update_shadow (void)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/passwd.c: static void update_shadow (void)
    -@@ src/passwd.c: static void update_shadow (void)
    - 		(void) spw_close ();
    - 		update_noshadow ();
    - 		if (spw_unlock () == 0) {
    +@@ src/passwd.c: static void update_shadow (struct option_flags *flags)
    + 		(void) spw_close (process_selinux);
    + 		update_noshadow (flags);
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/passwd.c: static void update_shadow (void)
    -+			(void) eprintf(_("%s: failed to unlock %s\n"),
    ++			eprintf(_("%s: failed to unlock %s\n"),
    @@ src/passwd.c: static void update_shadow (void)
    -@@ src/passwd.c: static void update_shadow (void)
    +@@ src/passwd.c: static void update_shadow (struct option_flags *flags)
    @@ src/passwd.c: static void update_shadow (void)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/passwd.c: static void update_shadow (void)
    - 	if (spw_close () == 0) {
    + 	if (spw_close (process_selinux) == 0) {
    @@ src/passwd.c: static void update_shadow (void)
    -+		(void) eprintf(_("%s: failure while writing changes to %s\n"),
    ++		eprintf(_("%s: failure while writing changes to %s\n"),
    @@ src/passwd.c: static void update_shadow (void)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/passwd.c: static void update_shadow (void)
    - 	if (spw_unlock () == 0) {
    + 	if (spw_unlock (process_selinux) == 0) {
    @@ src/passwd.c: static void update_shadow (void)
    -+		(void) eprintf(_("%s: failed to unlock %s\n"), Prog, spw_dbname());
    ++		eprintf(_("%s: failed to unlock %s\n"), Prog, spw_dbname());
    @@ src/passwd.c: main(int argc, char **argv)
    - 			fail_exit (E_NOPERM);
    + 			fail_exit (E_NOPERM, process_selinux);
    @@ src/pwck.c
    -@@ src/pwck.c: static void fail_exit (int code)
    +@@ src/pwck.c: static void fail_exit (int code, bool process_selinux)
    @@ src/pwck.c: static void fail_exit (int code)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/pwck.c: static void fail_exit (int code)
    -@@ src/pwck.c: static void fail_exit (int code)
    +@@ src/pwck.c: static void fail_exit (int code, bool process_selinux)
    @@ src/pwck.c: static void fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/pwck.c: static void fail_exit (int code)
    -@@ src/pwck.c: static void process_flags (int argc, char **argv)
    +@@ src/pwck.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/pwck.c: static void process_flags (int argc, char **argv)
    -@@ src/pwck.c: static void process_flags (int argc, char **argv)
    +@@ src/pwck.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/pwck.c: static void process_flags (int argc, char **argv)
    -@@ src/pwck.c: static void open_files (void)
    +@@ src/pwck.c: static void open_files (struct option_flags *flags)
    @@ src/pwck.c: static void open_files (void)
    - 			fail_exit (E_CANTLOCK);
    + 			fail_exit (E_CANTLOCK, process_selinux);
    @@ src/pwck.c: static void open_files (void)
    - 				fail_exit (E_CANTLOCK);
    + 				fail_exit (E_CANTLOCK, process_selinux);
    @@ src/pwck.c: static void open_files (void)
    -@@ src/pwck.c: static void open_files (void)
    +@@ src/pwck.c: static void open_files (struct option_flags *flags)
    @@ src/pwck.c: static void open_files (void)
    -@@ src/pwck.c: static void open_files (void)
    +@@ src/pwck.c: static void open_files (struct option_flags *flags)
    @@ src/pwck.c: static void open_files (void)
    -@@ src/pwck.c: static void close_files (bool changed)
    +@@ src/pwck.c: static void close_files (bool changed, struct option_flags *flags)
    @@ src/pwck.c: static void close_files (bool changed)
    - 		if (pw_close () == 0) {
    + 		if (pw_close (process_selinux) == 0) {
    @@ src/pwck.c: static void close_files (bool changed)
    -@@ src/pwck.c: static void close_files (bool changed)
    - 			fail_exit (E_CANTUPDATE);
    +@@ src/pwck.c: static void close_files (bool changed, struct option_flags *flags)
    + 			fail_exit (E_CANTUPDATE, process_selinux);
    @@ src/pwck.c: static void close_files (bool changed)
    - 		if (spw_opened && (spw_close () == 0)) {
    + 		if (spw_opened && (spw_close (process_selinux) == 0)) {
    @@ src/pwck.c: static void close_files (bool changed)
    -@@ src/pwck.c: static void close_files (bool changed)
    +@@ src/pwck.c: static void close_files (bool changed, struct option_flags *flags)
    @@ src/pwck.c: static void close_files (bool changed)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/pwck.c: static void close_files (bool changed)
    -@@ src/pwck.c: static void close_files (bool changed)
    +@@ src/pwck.c: static void close_files (bool changed, struct option_flags *flags)
    @@ src/pwck.c: static void close_files (bool changed)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/pwck.c: static void close_files (bool changed)
    -@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    +@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed, struct option_flags *fla
    @@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    - 					if (spw_unlock () == 0) {
    + 					if (spw_unlock (process_selinux) == 0) {
    @@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    -@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    +@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed, struct option_flags *fla
    @@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    - 						fail_exit (E_CANTUPDATE);
    + 						fail_exit (E_CANTUPDATE, process_selinux);
    @@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    -@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    +@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed, struct option_flags *fla
    @@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    - 						fail_exit (E_CANTUPDATE);
    + 						fail_exit (E_CANTUPDATE, process_selinux);
    @@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    -@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    +@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed, struct option_flags *fla
    @@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    - 			if (spw_opened && (spw_close () == 0)) {
    + 			if (spw_opened && (spw_close (process_selinux) == 0)) {
    @@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    -@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    +@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed, struct option_flags *fla
    @@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    - 			if (spw_unlock () == 0) {
    + 			if (spw_unlock (process_selinux) == 0) {
    @@ src/pwck.c: int main (int argc, char **argv)
    - 			fail_exit (E_CANTSORT);
    + 			fail_exit (E_CANTSORT, process_selinux);
    @@ src/pwck.c: int main (int argc, char **argv)
    - 				fail_exit (E_CANTSORT);
    + 				fail_exit (E_CANTSORT, process_selinux);
    @@ src/pwconv.c
    -@@ src/pwconv.c: static void fail_exit (int status)
    +@@ src/pwconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/pwconv.c: static void fail_exit (int status)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/pwconv.c: static void fail_exit (int status)
    -@@ src/pwconv.c: static void fail_exit (int status)
    +@@ src/pwconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/pwconv.c: static void fail_exit (int status)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 		fail_exit (E_PWDBUSY);
    + 		fail_exit (E_PWDBUSY, process_selinux);
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 		fail_exit (E_MISSING);
    + 		fail_exit (E_MISSING, process_selinux);
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 		fail_exit (E_PWDBUSY);
    + 		fail_exit (E_PWDBUSY, process_selinux);
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 			fail_exit (E_FAILURE);
    + 			fail_exit (E_FAILURE, process_selinux);
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 			fail_exit (E_FAILURE);
    + 			fail_exit (E_FAILURE, process_selinux);
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 			fail_exit (E_FAILURE);
    + 			fail_exit (E_FAILURE, process_selinux);
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 	if (spw_close () == 0) {
    + 	if (spw_close (process_selinux) == 0) {
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 	if (pw_close () == 0) {
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 	if (spw_unlock () == 0) {
    + 	if (spw_unlock (process_selinux) == 0) {
    @@ src/pwunconv.c
    -@@ src/pwunconv.c: static void fail_exit (int status)
    +@@ src/pwunconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/pwunconv.c: static void fail_exit (int status)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/pwunconv.c: static void fail_exit (int status)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 		fail_exit (5);
    + 		fail_exit (5, process_selinux);
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 		fail_exit (5);
    + 		fail_exit (5, process_selinux);
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 			fail_exit (3);
    + 			fail_exit (3, process_selinux);
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 	(void) spw_close (); /* was only open O_RDONLY */
    + 	(void) spw_close (process_selinux); /* was only open O_RDONLY */
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 	if (pw_close () == 0) {
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 		fail_exit (3);
    + 		fail_exit (3, process_selinux);
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 		fail_exit (3);
    + 		fail_exit (3, process_selinux);
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 	if (spw_unlock () == 0) {
    + 	if (spw_unlock (process_selinux) == 0) {
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/useradd.c
    -@@ src/useradd.c: static void fail_exit (int code)
    +@@ src/useradd.c: static void fail_exit (int code, bool process_selinux)
    @@ src/useradd.c: static void fail_exit (int code)
    - 	if (spw_locked && spw_unlock() == 0) {
    + 	if (spw_locked && spw_unlock(process_selinux) == 0) {
    @@ src/useradd.c: static void fail_exit (int code)
    - 	if (pw_locked && pw_unlock() == 0) {
    + 	if (pw_locked && pw_unlock(process_selinux) == 0) {
    @@ src/useradd.c: static void fail_exit (int code)
    - 	if (gr_locked && gr_unlock() == 0) {
    + 	if (gr_locked && gr_unlock(process_selinux) == 0) {
    @@ src/useradd.c: static void fail_exit (int code)
    - 	if (sgr_locked && sgr_unlock() == 0) {
    + 	if (sgr_locked && sgr_unlock(process_selinux) == 0) {
    @@ src/useradd.c: static void fail_exit (int code)
    - 	if (sub_uid_locked && sub_uid_unlock() == 0) {
    + 	if (sub_uid_locked && sub_uid_unlock(process_selinux) == 0) {
    @@ src/useradd.c: static void fail_exit (int code)
    - 	if (sub_gid_locked && sub_gid_unlock() == 0) {
    + 	if (sub_gid_locked && sub_gid_unlock(process_selinux) == 0) {
    @@ src/useradd.c: static void fail_exit (int code)
    -@@ src/useradd.c: get_defaults(void)
    +@@ src/useradd.c: get_defaults(struct option_flags *flags)
    @@ src/useradd.c: get_defaults(void)
    -@@ src/useradd.c: get_defaults(void)
    +@@ src/useradd.c: get_defaults(struct option_flags *flags)
    @@ src/useradd.c: get_defaults(void)
    - 			if (get_groups (cp) != 0) {
    + 			if (get_groups (cp, flags) != 0) {
    @@ src/useradd.c: get_defaults(void)
    -@@ src/useradd.c: get_defaults(void)
    +@@ src/useradd.c: get_defaults(struct option_flags *flags)
    @@ src/useradd.c: set_defaults(void)
    -@@ src/useradd.c: static int get_groups (char *list)
    +@@ src/useradd.c: static int get_groups (char *list, struct option_flags *flags)
    @@ src/useradd.c: static int get_groups (char *list)
    -@@ src/useradd.c: static int get_groups (char *list)
    +@@ src/useradd.c: static int get_groups (char *list, struct option_flags *flags)
    @@ src/useradd.c: static int get_groups (char *list)
    -@@ src/useradd.c: static struct group * get_local_group(char * grp_name)
    +@@ src/useradd.c: static struct group * get_local_group(char * grp_name, bool process_selinux)
    @@ src/useradd.c: static struct group * get_local_group(char * grp_name)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/useradd.c: static struct group * get_local_group(char * grp_name)
    -@@ src/useradd.c: static void grp_update (void)
    +@@ src/useradd.c: static void grp_update (bool process_selinux)
    @@ src/useradd.c: static void grp_update (void)
    - 			fail_exit (E_GRP_UPDATE);	/* XXX */
    -@@ src/useradd.c: static void grp_update (void)
    + 			fail_exit (E_GRP_UPDATE, process_selinux);	/* XXX */
    +@@ src/useradd.c: static void grp_update (bool process_selinux)
    @@ src/useradd.c: static void grp_update (void)
    - 			fail_exit (E_GRP_UPDATE);
    -@@ src/useradd.c: static void grp_update (void)
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    +@@ src/useradd.c: static void grp_update (bool process_selinux)
    @@ src/useradd.c: static void grp_update (void)
    - 			fail_exit (E_GRP_UPDATE);	/* XXX */
    -@@ src/useradd.c: static void grp_update (void)
    + 			fail_exit (E_GRP_UPDATE, process_selinux);	/* XXX */
    +@@ src/useradd.c: static void grp_update (bool process_selinux)
    @@ src/useradd.c: static void grp_update (void)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    +@@ src/useradd.c: static void process_flags (int argc, char **argv, struct option_flags *flags)
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void process_flags (int argc, char **argv)
    - static void close_files (void)
    - {
    - 	if (pw_close () == 0) {
    +@@ src/useradd.c: static void close_files (struct option_flags *flags)
    + 	process_selinux = !flags->chroot && !flags->prefix;
    + 
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    - 	if (is_shadow_pwd && (spw_close () == 0)) {
    + 	if (is_shadow_pwd && (spw_close (process_selinux) == 0)) {
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/useradd.c: static void process_flags (int argc, char **argv)
    -@@ src/useradd.c: static void close_files (void)
    +@@ src/useradd.c: static void close_files (struct option_flags *flags)
    @@ src/useradd.c: static void close_files (void)
    - 	if (is_sub_uid  && (sub_uid_close () == 0)) {
    + 	if (is_sub_uid  && (sub_uid_close (process_selinux) == 0)) {
    @@ src/useradd.c: static void close_files (void)
    - 		fail_exit (E_SUB_UID_UPDATE);
    + 		fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/useradd.c: static void close_files (void)
    - 	if (is_sub_gid  && (sub_gid_close () == 0)) {
    + 	if (is_sub_gid  && (sub_gid_close (process_selinux) == 0)) {
    @@ src/useradd.c: static void close_files (void)
    - 		fail_exit (E_SUB_GID_UPDATE);
    + 		fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/useradd.c: static void close_files (void)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/useradd.c: static void close_files (void)
    -@@ src/useradd.c: static void close_files (void)
    +@@ src/useradd.c: static void close_files (struct option_flags *flags)
    @@ src/useradd.c: static void close_files (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/useradd.c: static void close_files (void)
    -@@ src/useradd.c: static void close_files (void)
    +@@ src/useradd.c: static void close_files (struct option_flags *flags)
    @@ src/useradd.c: static void close_files (void)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/useradd.c: static void close_files (void)
    -@@ src/useradd.c: static void close_files (void)
    +@@ src/useradd.c: static void close_files (struct option_flags *flags)
    @@ src/useradd.c: static void close_files (void)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/useradd.c: static void close_files (void)
    -@@ src/useradd.c: static void close_group_files (void)
    +@@ src/useradd.c: static void close_group_files (bool process_selinux)
    @@ src/useradd.c: static void close_group_files (void)
    - 	if (gr_close() == 0) {
    + 	if (gr_close(process_selinux) == 0) {
    @@ src/useradd.c: static void close_group_files (void)
    - 		fail_exit(E_GRP_UPDATE);
    + 		fail_exit(E_GRP_UPDATE, process_selinux);
    @@ src/useradd.c: static void close_group_files (void)
    - 	if (is_shadow_grp && sgr_close() == 0) {
    + 	if (is_shadow_grp && sgr_close(process_selinux) == 0) {
    @@ src/useradd.c: static void close_group_files (void)
    - 		fail_exit(E_GRP_UPDATE);
    -@@ src/useradd.c: static void close_group_files (void)
    - static void unlock_group_files (void)
    + 		fail_exit(E_GRP_UPDATE, process_selinux);
    +@@ src/useradd.c: static void close_group_files (bool process_selinux)
    + static void unlock_group_files (bool process_selinux)
    @@ src/useradd.c: static void close_group_files (void)
    - 	if (gr_unlock () == 0) {
    + 	if (gr_unlock (process_selinux) == 0) {
    @@ src/useradd.c: static void close_group_files (void)
    -@@ src/useradd.c: static void unlock_group_files (void)
    +@@ src/useradd.c: static void unlock_group_files (bool process_selinux)
    @@ src/useradd.c: static void unlock_group_files (void)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/useradd.c: static void unlock_group_files (void)
    -@@ src/useradd.c: static void unlock_group_files (void)
    - static void open_files (void)
    +@@ src/useradd.c: static void unlock_group_files (bool process_selinux)
    + static void open_files (bool process_selinux)
    @@ src/useradd.c: static void unlock_group_files (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/useradd.c: static void unlock_group_files (void)
    -@@ src/useradd.c: static void open_files (void)
    +@@ src/useradd.c: static void open_files (bool process_selinux)
    @@ src/useradd.c: static void open_files (void)
    - 			fail_exit (E_SUB_UID_UPDATE);
    + 			fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/useradd.c: static void open_files (void)
    - 			fail_exit (E_SUB_UID_UPDATE);
    + 			fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/useradd.c: static void open_files (void)
    - 			fail_exit (E_SUB_GID_UPDATE);
    + 			fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/useradd.c: static void open_files (void)
    - 			fail_exit (E_SUB_GID_UPDATE);
    + 			fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/useradd.c: static void open_files (void)
    -@@ src/useradd.c: static void open_files (void)
    - static void open_group_files (void)
    +@@ src/useradd.c: static void open_files (bool process_selinux)
    + static void open_group_files (bool process_selinux)
    @@ src/useradd.c: static void open_files (void)
    - 		fail_exit (E_GRP_UPDATE);
    + 		fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/useradd.c: static void open_files (void)
    - 		fail_exit (E_GRP_UPDATE);
    + 		fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/useradd.c: static void open_files (void)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/useradd.c: static void open_files (void)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/useradd.c: static void open_files (void)
    -@@ src/useradd.c: static void open_shadow (void)
    +@@ src/useradd.c: static void open_shadow (bool process_selinux)
    @@ src/useradd.c: static void open_shadow (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/useradd.c: static void open_shadow (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/useradd.c: static void open_shadow (void)
    -@@ src/useradd.c: static void grp_add (void)
    +@@ src/useradd.c: static void grp_add (bool process_selinux)
    @@ src/useradd.c: static void grp_add (void)
    -@@ src/useradd.c: static void grp_add (void)
    +@@ src/useradd.c: static void grp_add (bool process_selinux)
    @@ src/useradd.c: static void tallylog_reset (const char *user_name)
    -@@ src/useradd.c: static void usr_update (unsigned long subuid_count, unsigned long subgid_count)
    +@@ src/useradd.c: usr_update (unsigned long subuid_count, unsigned long subgid_count,
    @@ src/useradd.c: static void usr_update (unsigned long subuid_count, unsigned long
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/useradd.c: static void usr_update (unsigned long subuid_count, unsigned long
    -@@ src/useradd.c: static void usr_update (unsigned long subuid_count, unsigned long subgid_count)
    +@@ src/useradd.c: usr_update (unsigned long subuid_count, unsigned long subgid_count,
    @@ src/useradd.c: static void usr_update (unsigned long subuid_count, unsigned long
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/useradd.c: static void usr_update (unsigned long subuid_count, unsigned long
    - 		fail_exit (E_SUB_UID_UPDATE);
    + 		fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/useradd.c: static void usr_update (unsigned long subuid_count, unsigned long
    - 		fail_exit (E_SUB_GID_UPDATE);
    + 		fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/useradd.c: static void usr_update (unsigned long subuid_count, unsigned long
    -@@ src/useradd.c: static void create_home (void)
    +@@ src/useradd.c: static void create_home (struct option_flags *flags)
    @@ src/useradd.c: static void create_home (void)
    - 		fail_exit(E_HOMEDIR);
    + 		fail_exit(E_HOMEDIR, process_selinux);
    @@ src/useradd.c: static void create_home (void)
    - 
    +@@ src/useradd.c: static void create_home (struct option_flags *flags)
    @@ src/useradd.c: static void create_home (void)
    - 	if (set_selinux_file_context(prefix_user_home, S_IFDIR) != 0) {
    --		fprintf(stderr,
    --			_("%s: cannot set SELinux context for home directory %s\n"),
    -+		eprintf(_("%s: cannot set SELinux context for home directory %s\n"),
    - 			Prog, user_home);
    - 		fail_exit(E_HOMEDIR);
    - 	}
    -@@ src/useradd.c: static void create_home (void)
    + 	if (process_selinux) {
    + 		if (set_selinux_file_context(prefix_user_home, S_IFDIR) != 0) {
    +-			fprintf(stderr,
    +-				_("%s: cannot set SELinux context for home directory %s\n"),
    ++			eprintf(_("%s: cannot set SELinux context for home directory %s\n"),
    + 				Prog, user_home);
    + 			fail_exit(E_HOMEDIR, process_selinux);
    + 		}
    +@@ src/useradd.c: static void create_home (struct option_flags *flags)
    @@ src/useradd.c: static void create_home (void)
    - 				fail_exit(E_HOMEDIR);
    + 				fail_exit(E_HOMEDIR, process_selinux);
    @@ src/useradd.c: static void create_home (void)
    - 				fail_exit(E_HOMEDIR);
    + 				fail_exit(E_HOMEDIR, process_selinux);
    @@ src/useradd.c: static void create_home (void)
    - 				fail_exit(E_HOMEDIR);
    + 				fail_exit(E_HOMEDIR, process_selinux);
    @@ src/useradd.c: static void create_home (void)
    -@@ src/useradd.c: static void create_home (void)
    +@@ src/useradd.c: static void create_home (struct option_flags *flags)
    @@ src/useradd.c: static void create_home (void)
    - 			fail_exit(E_HOMEDIR);
    + 			fail_exit(E_HOMEDIR, process_selinux);
    @@ src/useradd.c: static void create_home (void)
    -@@ src/useradd.c: static void create_home (void)
    +@@ src/useradd.c: static void create_home (struct option_flags *flags)
    @@ src/useradd.c: static void create_home (void)
    -@@ src/useradd.c: static void create_home (void)
    +@@ src/useradd.c: static void create_home (struct option_flags *flags)
    + 	if (process_selinux) {
    + 		/* Reset SELinux to create files with default contexts */
    + 		if (reset_selinux_file_context() != 0) {
    +-			fprintf(stderr,
    +-				_("%s: cannot reset SELinux file creation context\n"),
    ++			eprintf(_("%s: cannot reset SELinux file creation context\n"),
    + 				Prog);
    + 			fail_exit(E_HOMEDIR, process_selinux);
    + 		}
    +@@ src/useradd.c: static void create_mail (struct option_flags *flags)
    @@ src/useradd.c: static void create_home (void)
    - 	/* Reset SELinux to create files with default contexts */
    - 	if (reset_selinux_file_context() != 0) {
    --		fprintf(stderr,
    --			_("%s: cannot reset SELinux file creation context\n"),
    -+		eprintf(_("%s: cannot reset SELinux file creation context\n"),
    - 			Prog);
    - 		fail_exit(E_HOMEDIR);
    + 	if (process_selinux) {
    + 		if (set_selinux_file_context(file, S_IFREG) != 0) {
    +-			fprintf(stderr,
    +-					_("%s: cannot set SELinux context for mailbox file %s\n"),
    +-					Prog, file);
    ++			eprintf(_("%s: cannot set SELinux context for mailbox file %s\n"),
    ++				Prog, file);
    + 			fail_exit(E_MAILBOXFILE, process_selinux);
    + 		}
    @@ src/useradd.c: static void create_home (void)
    -@@ src/useradd.c: static void create_mail (void)
    - 
    - #ifdef WITH_SELINUX
    - 	if (set_selinux_file_context(file, S_IFREG) != 0) {
    --		fprintf(stderr,
    --		        _("%s: cannot set SELinux context for mailbox file %s\n"),
    -+		eprintf(_("%s: cannot set SELinux context for mailbox file %s\n"),
    - 		        Prog, file);
    - 		fail_exit(E_MAILBOXFILE);
    - 	}
    -@@ src/useradd.c: static void create_mail (void)
    - #ifdef WITH_SELINUX
    - 	/* Reset SELinux to create files with default contexts */
    - 	if (reset_selinux_file_context() != 0) {
    --		fprintf(stderr,
    --		        _("%s: cannot reset SELinux file creation context\n"),
    -+		eprintf(_("%s: cannot reset SELinux file creation context\n"),
    - 		        Prog);
    - 		fail_exit(E_MAILBOXFILE);
    +@@ src/useradd.c: static void create_mail (struct option_flags *flags)
    + 	if (process_selinux) {
    + 		/* Reset SELinux to create files with default contexts */
    + 		if (reset_selinux_file_context() != 0) {
    +-			fprintf(stderr,
    +-					_("%s: cannot reset SELinux file creation context\n"),
    +-					Prog);
    ++			eprintf(_("%s: cannot reset SELinux file creation context\n"),
    ++				Prog);
    + 			fail_exit(E_MAILBOXFILE, process_selinux);
    + 		}
    @@ src/useradd.c: int main (int argc, char **argv)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/useradd.c: int main (int argc, char **argv)
    - 		fail_exit (E_NAME_IN_USE);
    + 		fail_exit (E_NAME_IN_USE, process_selinux);
    @@ src/useradd.c: int main (int argc, char **argv)
    - 			fail_exit (E_NAME_IN_USE);
    + 			fail_exit (E_NAME_IN_USE, process_selinux);
    @@ src/useradd.c: int main (int argc, char **argv)
    - 				fail_exit (E_UID_IN_USE);
    + 				fail_exit (E_UID_IN_USE, process_selinux);
    @@ src/useradd.c: int main (int argc, char **argv)
    - 				fail_exit (E_UID_IN_USE);
    + 				fail_exit (E_UID_IN_USE, process_selinux);
    @@ src/useradd.c: int main (int argc, char **argv)
    - 			fail_exit (E_UID_IN_USE);
    + 			fail_exit (E_UID_IN_USE, process_selinux);
    @@ src/useradd.c: int main (int argc, char **argv)
    - 			fail_exit (4);
    + 			fail_exit (4, process_selinux);
    @@ src/useradd.c: int main (int argc, char **argv)
    - 		grp_add ();
    + 		grp_add (process_selinux);
    @@ src/useradd.c: int main (int argc, char **argv)
    - 			fail_exit(E_SUB_UID_UPDATE);
    + 			fail_exit(E_SUB_UID_UPDATE, process_selinux);
    @@ src/useradd.c: int main (int argc, char **argv)
    - 			fail_exit(E_SUB_GID_UPDATE);
    + 			fail_exit(E_SUB_GID_UPDATE, process_selinux);
    @@ src/userdel.c
    -@@ src/userdel.c: static void update_groups (void)
    +@@ src/userdel.c: static void update_groups (bool process_selinux)
    @@ src/userdel.c: static void update_groups (void)
    -@@ src/userdel.c: static void update_groups (void)
    +@@ src/userdel.c: static void update_groups (bool process_selinux)
    @@ src/userdel.c: static void update_groups (void)
    -@@ src/userdel.c: static void update_groups (void)
    +@@ src/userdel.c: static void update_groups (bool process_selinux)
    @@ src/userdel.c: static void update_groups (void)
    -@@ src/userdel.c: static void remove_usergroup (void)
    +@@ src/userdel.c: static void remove_usergroup (bool process_selinux)
    @@ src/userdel.c: static void remove_usergroup (void)
    -@@ src/userdel.c: static void remove_usergroup (void)
    +@@ src/userdel.c: static void remove_usergroup (bool process_selinux)
    @@ src/userdel.c: static void remove_usergroup (void)
    -@@ src/userdel.c: static void remove_usergroup (void)
    +@@ src/userdel.c: static void remove_usergroup (bool process_selinux)
    @@ src/userdel.c: static void remove_usergroup (void)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/userdel.c: static void remove_usergroup (void)
    -@@ src/userdel.c: static void remove_usergroup (void)
    +@@ src/userdel.c: static void remove_usergroup (bool process_selinux)
    @@ src/userdel.c: static void remove_usergroup (void)
    - 				fail_exit (E_GRP_UPDATE);
    + 				fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/userdel.c: static void remove_usergroup (void)
    -@@ src/userdel.c: static void remove_usergroup (void)
    - static void close_files (void)
    - {
    - 	if (pw_close () == 0) {
    +@@ src/userdel.c: static void close_files (struct option_flags *flags)
    + 	process_selinux = !flags->chroot && !flags->prefix;
    + 
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/userdel.c: static void remove_usergroup (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/userdel.c: static void remove_usergroup (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void remove_usergroup (void)
    -@@ src/userdel.c: static void close_files (void)
    +@@ src/userdel.c: static void close_files (struct option_flags *flags)
    @@ src/userdel.c: static void close_files (void)
    - 		if (spw_close () == 0) {
    + 		if (spw_close (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    - 			fail_exit (E_PW_UPDATE);
    + 			fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/userdel.c: static void close_files (void)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    -@@ src/userdel.c: static void close_files (void)
    +@@ src/userdel.c: static void close_files (struct option_flags *flags)
    @@ src/userdel.c: static void close_files (void)
    - 	if (gr_close () == 0) {
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    - 		fail_exit (E_GRP_UPDATE);
    + 		fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/userdel.c: static void close_files (void)
    - 	if (gr_unlock () == 0) {
    + 	if (gr_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    -@@ src/userdel.c: static void close_files (void)
    +@@ src/userdel.c: static void close_files (struct option_flags *flags)
    @@ src/userdel.c: static void close_files (void)
    - 		if (sgr_close () == 0) {
    + 		if (sgr_close (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/userdel.c: static void close_files (void)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    -@@ src/userdel.c: static void close_files (void)
    +@@ src/userdel.c: static void close_files (struct option_flags *flags)
    @@ src/userdel.c: static void close_files (void)
    - 		if (sub_uid_close () == 0) {
    + 		if (sub_uid_close (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    - 			fail_exit (E_SUB_UID_UPDATE);
    + 			fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/userdel.c: static void close_files (void)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    -@@ src/userdel.c: static void close_files (void)
    +@@ src/userdel.c: static void close_files (struct option_flags *flags)
    @@ src/userdel.c: static void close_files (void)
    - 		if (sub_gid_close () == 0) {
    + 		if (sub_gid_close (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    - 			fail_exit (E_SUB_GID_UPDATE);
    + 			fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/userdel.c: static void close_files (void)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    -@@ src/userdel.c: static void fail_exit (int code)
    +@@ src/userdel.c: static void fail_exit (int code, bool process_selinux)
    @@ src/userdel.c: static void fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void fail_exit (int code)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void fail_exit (int code)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void fail_exit (int code)
    -@@ src/userdel.c: static void fail_exit (int code)
    +@@ src/userdel.c: static void fail_exit (int code, bool process_selinux)
    @@ src/userdel.c: static void fail_exit (int code)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void fail_exit (int code)
    -@@ src/userdel.c: static void fail_exit (int code)
    +@@ src/userdel.c: static void fail_exit (int code, bool process_selinux)
    @@ src/userdel.c: static void fail_exit (int code)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void fail_exit (int code)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void fail_exit (int code)
    -@@ src/userdel.c: static void fail_exit (int code)
    - static void open_files (void)
    +@@ src/userdel.c: static void fail_exit (int code, bool process_selinux)
    + static void open_files (bool process_selinux)
    @@ src/userdel.c: static void fail_exit (int code)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/userdel.c: static void fail_exit (int code)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/userdel.c: static void fail_exit (int code)
    - 			fail_exit (E_PW_UPDATE);
    + 			fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/userdel.c: static void fail_exit (int code)
    - 			fail_exit (E_PW_UPDATE);
    + 			fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/userdel.c: static void fail_exit (int code)
    - 		fail_exit (E_GRP_UPDATE);
    + 		fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/userdel.c: static void fail_exit (int code)
    - 		fail_exit (E_GRP_UPDATE);
    + 		fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/userdel.c: static void fail_exit (int code)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/userdel.c: static void fail_exit (int code)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/userdel.c: static void fail_exit (int code)
    -@@ src/userdel.c: static void open_files (void)
    +@@ src/userdel.c: static void open_files (bool process_selinux)
    @@ src/userdel.c: static void open_files (void)
    - 			fail_exit (E_SUB_UID_UPDATE);
    + 			fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/userdel.c: static void open_files (void)
    - 			fail_exit (E_SUB_UID_UPDATE);
    + 			fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/userdel.c: static void open_files (void)
    - 			fail_exit (E_SUB_GID_UPDATE);
    + 			fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/userdel.c: static void open_files (void)
    - 			fail_exit (E_SUB_GID_UPDATE);
    + 			fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/userdel.c: static void open_files (void)
    -@@ src/userdel.c: static void open_files (void)
    - static void update_user (void)
    +@@ src/userdel.c: static void open_files (bool process_selinux)
    + static void update_user (bool process_selinux)
    @@ src/userdel.c: static void open_files (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/userdel.c: static void open_files (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/userdel.c: static void open_files (void)
    - 		fail_exit (E_SUB_UID_UPDATE);
    + 		fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/userdel.c: static void open_files (void)
    - 		fail_exit (E_SUB_GID_UPDATE);
    + 		fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/userdel.c: int main (int argc, char **argv)
    - 			pw_close();
    + 			pw_close(process_selinux);
    @@ src/usermod.c: static char *new_pw_passwd (char *pw_pass)
    -@@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    +@@ src/usermod.c: static void new_pwent (struct passwd *pwent, bool process_selinux)
    @@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    - 			fail_exit (E_NAME_IN_USE);
    + 			fail_exit (E_NAME_IN_USE, process_selinux);
    @@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    -@@ src/usermod.c: static void new_spent (struct spwd *spent)
    +@@ src/usermod.c: static void new_spent (struct spwd *spent, bool process_selinux)
    @@ src/usermod.c: static void new_spent (struct spwd *spent)
    - 			fail_exit (E_NAME_IN_USE);
    + 			fail_exit (E_NAME_IN_USE, process_selinux);
    @@ src/usermod.c: static void new_spent (struct spwd *spent)
    -@@ src/usermod.c: fail_exit (int code)
    +@@ src/usermod.c: fail_exit (int code, bool process_selinux)
    @@ src/usermod.c: fail_exit (int code)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/usermod.c: fail_exit (int code)
    -@@ src/usermod.c: fail_exit (int code)
    +@@ src/usermod.c: fail_exit (int code, bool process_selinux)
    @@ src/usermod.c: fail_exit (int code)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/usermod.c: fail_exit (int code)
    -@@ src/usermod.c: fail_exit (int code)
    +@@ src/usermod.c: fail_exit (int code, bool process_selinux)
    @@ src/usermod.c: fail_exit (int code)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/usermod.c: fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/usermod.c: fail_exit (int code)
    -@@ src/usermod.c: fail_exit (int code)
    +@@ src/usermod.c: fail_exit (int code, bool process_selinux)
    @@ src/usermod.c: fail_exit (int code)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/usermod.c: fail_exit (int code)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/usermod.c: fail_exit (int code)
    -@@ src/usermod.c: update_group(const struct group *grp)
    +@@ src/usermod.c: update_group(const struct group *grp, bool process_selinux)
    @@ src/usermod.c: update_group(const struct group *grp)
    - 		fail_exit (E_GRP_UPDATE);
    + 		fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/usermod.c: update_group(const struct group *grp)
    -@@ src/usermod.c: update_group(const struct group *grp)
    +@@ src/usermod.c: update_group(const struct group *grp, bool process_selinux)
    @@ src/usermod.c: update_group(const struct group *grp)
    - 		fail_exit (E_GRP_UPDATE);
    -@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    + 		fail_exit (E_GRP_UPDATE, process_selinux);
    +@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp, bool process_selinux)
    @@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    - 		fail_exit (E_GRP_UPDATE);
    + 		fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    -@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    +@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp, bool process_selinux)
    @@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    - 	}
    + #endif				/* WITH_SELINUX */
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    +@@ src/usermod.c: process_flags(int argc, char **argv, struct option_flags *flags)
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: process_flags(int argc, char **argv)
    - static void close_files (void)
    - {
    - 	if (pw_close () == 0) {
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    + 	process_selinux = !flags->chroot && !flags->prefix;
    + 
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/usermod.c: process_flags(int argc, char **argv)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/usermod.c: process_flags(int argc, char **argv)
    - 	if (is_shadow_pwd && (spw_close () == 0)) {
    + 	if (is_shadow_pwd && (spw_close (process_selinux) == 0)) {
    @@ src/usermod.c: process_flags(int argc, char **argv)
    -@@ src/usermod.c: static void close_files (void)
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    @@ src/usermod.c: static void close_files (void)
    - 		if (gr_close () == 0) {
    + 		if (gr_close (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    @@ src/usermod.c: static void close_files (void)
    - 			if (sgr_close () == 0) {
    + 			if (sgr_close (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    @@ src/usermod.c: static void close_files (void)
    - 			if (sgr_unlock () == 0) {
    + 			if (sgr_unlock (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    @@ src/usermod.c: static void close_files (void)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    @@ src/usermod.c: static void close_files (void)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    @@ src/usermod.c: static void close_files (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    @@ src/usermod.c: static void close_files (void)
    - 		if (sub_uid_close () == 0) {
    + 		if (sub_uid_close (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    - 			fail_exit (E_SUB_UID_UPDATE);
    + 			fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/usermod.c: static void close_files (void)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    @@ src/usermod.c: static void close_files (void)
    - 		if (sub_gid_close () == 0) {
    + 		if (sub_gid_close (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    - 			fail_exit (E_SUB_GID_UPDATE);
    + 			fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/usermod.c: static void close_files (void)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    - static void open_files (void)
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    + static void open_files (bool process_selinux)
    @@ src/usermod.c: static void close_files (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/usermod.c: static void close_files (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/usermod.c: static void close_files (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/usermod.c: static void close_files (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void open_files (void)
    +@@ src/usermod.c: static void open_files (bool process_selinux)
    @@ src/usermod.c: static void open_files (void)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/usermod.c: static void open_files (void)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/usermod.c: static void open_files (void)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/usermod.c: static void open_files (void)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/usermod.c: static void open_files (void)
    -@@ src/usermod.c: static void open_files (void)
    +@@ src/usermod.c: static void open_files (bool process_selinux)
    @@ src/usermod.c: static void open_files (void)
    - 			fail_exit (E_SUB_UID_UPDATE);
    + 			fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/usermod.c: static void open_files (void)
    - 			fail_exit (E_SUB_UID_UPDATE);
    + 			fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/usermod.c: static void open_files (void)
    - 			fail_exit (E_SUB_GID_UPDATE);
    + 			fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/usermod.c: static void open_files (void)
    - 			fail_exit (E_SUB_GID_UPDATE);
    + 			fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/usermod.c: static void open_files (void)
    -@@ src/usermod.c: static void usr_update (void)
    +@@ src/usermod.c: static void usr_update (struct option_flags *flags)
    @@ src/usermod.c: static void usr_update (void)
    - 		fail_exit (E_NOTFOUND);
    + 		fail_exit (E_NOTFOUND, process_selinux);
    @@ src/usermod.c: static void usr_update (void)
    -@@ src/usermod.c: static void usr_update (void)
    +@@ src/usermod.c: static void usr_update (struct option_flags *flags)
    @@ src/usermod.c: static void usr_update (void)
    - 			fail_exit (E_PW_UPDATE);
    + 			fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/usermod.c: static void usr_update (void)
    - 			fail_exit (E_PW_UPDATE);
    + 			fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/usermod.c: static void usr_update (void)
    - 			fail_exit (E_PW_UPDATE);
    + 			fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/usermod.c: static void usr_update (void)
    - 			fail_exit (E_PW_UPDATE);
    + 			fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/usermod.c: static void usr_update (void)
    -@@ src/usermod.c: static void move_home (void)
    +@@ src/usermod.c: static void move_home (bool process_selinux)
    @@ src/usermod.c: static void move_home (void)
    - 		fail_exit (E_HOMEDIR);
    + 		fail_exit (E_HOMEDIR, process_selinux);
    @@ src/usermod.c: static void move_home (void)
    -@@ src/usermod.c: static void move_home (void)
    +@@ src/usermod.c: static void move_home (bool process_selinux)
    @@ src/usermod.c: static void move_home (void)
    - 			fail_exit (E_HOMEDIR);
    + 			fail_exit (E_HOMEDIR, process_selinux);
    @@ src/usermod.c: static void move_home (void)
    -@@ src/usermod.c: static void move_home (void)
    +@@ src/usermod.c: static void move_home (bool process_selinux)
    @@ src/usermod.c: static void move_home (void)
    - 				fail_exit (E_HOMEDIR);
    + 				fail_exit (E_HOMEDIR, process_selinux);
    @@ src/usermod.c: static void move_home (void)
    -@@ src/usermod.c: static void move_home (void)
    +@@ src/usermod.c: static void move_home (bool process_selinux)
    @@ src/usermod.c: static void move_home (void)
    - 					fail_exit (E_HOMEDIR);
    + 					fail_exit (E_HOMEDIR, process_selinux);
    @@ src/usermod.c: static void move_home (void)
    -@@ src/usermod.c: static void move_home (void)
    +@@ src/usermod.c: static void move_home (bool process_selinux)
    @@ src/usermod.c: static void move_home (void)
    -@@ src/usermod.c: static void move_home (void)
    +@@ src/usermod.c: static void move_home (bool process_selinux)
    @@ src/usermod.c: static void move_home (void)
    - 			fail_exit (E_HOMEDIR);
    + 			fail_exit (E_HOMEDIR, process_selinux);
    @@ src/usermod.c: int main (int argc, char **argv)
    - 				fail_exit (E_HOMEDIR);
    + 				fail_exit (E_HOMEDIR, process_selinux);
    @@ src/vipw.c: static void vipwexit (const char *msg, int syserr, int ret)
    - 		if ((*unlock) () == 0) {
    + 		if ((*unlock) (true) == 0) {
    @@ src/vipw.c: static void vipwexit (const char *msg, int syserr, int ret)
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    - 	if ((*file_unlock) () == 0) {
    + 	if ((*file_unlock) (true) == 0) {
 4:  c303977c =  4:  86d632c8 lib/string/: strerrno(): Add function
 5:  05f95c6f !  5:  931f9e4b lib/, src/: Use strerrno() instead of its pattern
    @@ src/chage.c: int main (int argc, char **argv)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chgpasswd.c
    - #include "exitcodes.h"
    + #include "shadow/gshadow/sgrp.h"
    @@ src/chgpasswd.c
    - 
    + /*
    @@ src/chgpasswd.c: int main (int argc, char **argv)
    - 				fail_exit (1);
    + 				fail_exit (1, process_selinux);
    @@ src/chpasswd.c: int main (int argc, char **argv)
    - 				fail_exit (1);
    + 				fail_exit (1, process_selinux);
    @@ src/gpasswd.c
    - 
    - /*
    + struct option_flags {
    + 	bool chroot;
    @@ src/groupadd.c
    - #endif
    + #include "shadow/gshadow/sgrp.h"
    @@ src/groupadd.c
    -@@ src/groupadd.c: static void open_files (void)
    +@@ src/groupadd.c: static void open_files (struct option_flags *flags)
    @@ src/newusers.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 					fail_exit (EXIT_FAILURE);
    + 					fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 				fail_exit (EXIT_FAILURE);
    + 				fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/vipw.c
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
 6:  5a448c24 !  6:  2e5885c8 lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro
    @@ lib/cleanup_group.c: void cleanup_report_del_group_gshadow (void *group_name)
    -@@ lib/cleanup_group.c: void cleanup_unlock_group (MAYBE_UNUSED void *arg)
    +@@ lib/cleanup_group.c: void cleanup_unlock_group (void *process_selinux)
    @@ lib/cleanup_group.c: void cleanup_unlock_group (MAYBE_UNUSED void *arg)
    -@@ lib/cleanup_group.c: void cleanup_unlock_gshadow (MAYBE_UNUSED void *arg)
    +@@ lib/cleanup_group.c: void cleanup_unlock_gshadow (void *process_selinux)
    @@ lib/cleanup_user.c: void cleanup_report_add_user_shadow (void *user_name)
    -@@ lib/cleanup_user.c: void cleanup_unlock_passwd (MAYBE_UNUSED void *arg)
    +@@ lib/cleanup_user.c: void cleanup_unlock_passwd (void *process_selinux)
    @@ lib/cleanup_user.c: void cleanup_unlock_passwd (MAYBE_UNUSED void *arg)
    -@@ lib/cleanup_user.c: void cleanup_unlock_shadow (MAYBE_UNUSED void *arg)
    +@@ lib/cleanup_user.c: void cleanup_unlock_shadow (void *process_selinux)
    @@ src/chage.c
    -@@ src/chage.c: fail_exit (int code)
    +@@ src/chage.c: fail_exit (int code, bool process_selinux)
    @@ src/chage.c: fail_exit (int code)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/chage.c: fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/chage.c: fail_exit (int code)
    -@@ src/chage.c: static void open_files (bool readonly)
    +@@ src/chage.c: static void open_files (bool readonly, struct option_flags *flags)
    @@ src/chage.c: static void open_files (bool readonly)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: static void open_files (bool readonly)
    -@@ src/chage.c: static void open_files (bool readonly)
    +@@ src/chage.c: static void open_files (bool readonly, struct option_flags *flags)
    @@ src/chage.c: static void open_files (bool readonly)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: static void open_files (bool readonly)
    -@@ src/chage.c: static void close_files (void)
    +@@ src/chage.c: static void close_files (struct option_flags *flags)
    @@ src/chage.c: static void close_files (void)
    - 	if (spw_close () == 0) {
    + 	if (spw_close (process_selinux) == 0) {
    @@ src/chage.c: static void close_files (void)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: static void close_files (void)
    -@@ src/chage.c: static void close_files (void)
    +@@ src/chage.c: static void close_files (struct option_flags *flags)
    @@ src/chage.c: static void close_files (void)
    - 	if (pw_close () == 0) {
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/chage.c: static void close_files (void)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chage.c: static void close_files (void)
    - 	if (spw_unlock () == 0) {
    + 	if (spw_unlock (process_selinux) == 0) {
    @@ src/chage.c: static void close_files (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/chage.c: int main (int argc, char **argv)
    - 	close_files ();
    + 	close_files (&flags);
    @@ src/chfn.c
    -@@ src/chfn.c: static void fail_exit (int code)
    +@@ src/chfn.c: static void fail_exit (int code, bool process_selinux)
    @@ src/chfn.c: static void fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/chfn.c: static void check_perms (const struct passwd *pw)
    -@@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    +@@ src/chfn.c: static void update_gecos (const char *user, char *gecos, struct option_flags *fl
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    -@@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    +@@ src/chfn.c: static void update_gecos (const char *user, char *gecos, struct option_flags *fl
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    - 	if (pw_close () == 0) {
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: static void update_gecos (const char *user, char *gecos)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/chfn.c: int main (int argc, char **argv)
    - 			fail_exit (E_NOPERM);
    + 			fail_exit (E_NOPERM, process_selinux);
    @@ src/chfn.c: int main (int argc, char **argv)
    - 	update_gecos (user, new_gecos);
    + 	update_gecos (user, new_gecos, &flags);
    @@ src/chgpasswd.c
    -@@ src/chgpasswd.c: static void fail_exit (int code)
    +@@ src/chgpasswd.c: static void fail_exit (int code, bool process_selinux)
    @@ src/chgpasswd.c: static void fail_exit (int code)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/chgpasswd.c: static void fail_exit (int code)
    -@@ src/chgpasswd.c: static void fail_exit (int code)
    +@@ src/chgpasswd.c: static void fail_exit (int code, bool process_selinux)
    @@ src/chgpasswd.c: static void fail_exit (int code)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/chgpasswd.c: static void check_perms (void)
    -@@ src/chgpasswd.c: static void close_files (void)
    - 		if (sgr_close () == 0) {
    +@@ src/chgpasswd.c: static void close_files (struct option_flags *flags)
    + 		if (sgr_close (process_selinux) == 0) {
    @@ src/chgpasswd.c: static void close_files (void)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/chgpasswd.c: static void close_files (void)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/chgpasswd.c: static void close_files (void)
    -@@ src/chgpasswd.c: static void close_files (void)
    - 	if (gr_close () == 0) {
    +@@ src/chgpasswd.c: static void close_files (struct option_flags *flags)
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/chgpasswd.c: static void close_files (void)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chgpasswd.c: static void close_files (void)
    - 	if (gr_unlock () == 0) {
    + 	if (gr_unlock (process_selinux) == 0) {
    @@ src/chpasswd.c
    -@@ src/chpasswd.c: static void fail_exit (int code)
    +@@ src/chpasswd.c: static void fail_exit (int code, bool process_selinux)
    @@ src/chpasswd.c: static void fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/chpasswd.c: static void fail_exit (int code)
    -@@ src/chpasswd.c: static void fail_exit (int code)
    +@@ src/chpasswd.c: static void fail_exit (int code, bool process_selinux)
    @@ src/chpasswd.c: static void fail_exit (int code)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/chpasswd.c: static void check_perms (void)
    -@@ src/chpasswd.c: static void close_files (void)
    - 		if (spw_close () == 0) {
    +@@ src/chpasswd.c: static void close_files (struct option_flags *flags)
    + 		if (spw_close (process_selinux) == 0) {
    @@ src/chpasswd.c: static void close_files (void)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/chpasswd.c: static void close_files (void)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/chpasswd.c: static void close_files (void)
    -@@ src/chpasswd.c: static void close_files (void)
    - 	if (pw_close () == 0) {
    +@@ src/chpasswd.c: static void close_files (struct option_flags *flags)
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/chpasswd.c: static void close_files (void)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chpasswd.c: static void close_files (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/chsh.c
    -@@ src/chsh.c: fail_exit (int code)
    +@@ src/chsh.c: fail_exit (int code, bool process_selinux)
    @@ src/chsh.c: fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/chsh.c: fail_exit (int code)
    -@@ src/chsh.c: static void check_perms (const struct passwd *pw)
    +@@ src/chsh.c: static void check_perms (const struct passwd *pw, struct option_flags *flags)
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    -@@ src/chsh.c: static void check_perms (const struct passwd *pw)
    +@@ src/chsh.c: static void check_perms (const struct passwd *pw, struct option_flags *flags)
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    -@@ src/chsh.c: static void check_perms (const struct passwd *pw)
    +@@ src/chsh.c: static void check_perms (const struct passwd *pw, struct option_flags *flags)
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    -@@ src/chsh.c: static void check_perms (const struct passwd *pw)
    +@@ src/chsh.c: static void check_perms (const struct passwd *pw, struct option_flags *flags)
    @@ src/chsh.c: static void check_perms (const struct passwd *pw)
    -@@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    +@@ src/chsh.c: static void update_shell (const char *user, char *newshell, struct option_flags
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    -@@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    +@@ src/chsh.c: static void update_shell (const char *user, char *newshell, struct option_flags
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    -@@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    +@@ src/chsh.c: static void update_shell (const char *user, char *newshell, struct option_flags
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    - 	if (pw_close () == 0) {
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    - 		fail_exit (1);
    + 		fail_exit (1, process_selinux);
    @@ src/chsh.c: static void update_shell (const char *user, char *newshell)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/chsh.c: int main (int argc, char **argv)
    - 			fail_exit (1);
    + 			fail_exit (1, process_selinux);
    @@ src/chsh.c: int main (int argc, char **argv)
    - 	update_shell (user, loginsh);
    + 	update_shell (user, loginsh, &flags);
    @@ src/gpasswd.c: static void log_gpasswd_success (const char *suffix)
    -@@ src/gpasswd.c: static void get_group (struct group *gr)
    +@@ src/gpasswd.c: static void get_group (struct group *gr, struct option_flags *flags)
    @@ src/gpasswd.c: static void get_group (struct group *gr)
    -@@ src/gpasswd.c: static void get_group (struct group *gr)
    - 	if (gr_close () == 0) {
    +@@ src/gpasswd.c: static void get_group (struct group *gr, struct option_flags *flags)
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/gpasswd.c: static void get_group (struct group *gr)
    -@@ src/gpasswd.c: static void get_group (struct group *gr)
    +@@ src/gpasswd.c: static void get_group (struct group *gr, struct option_flags *flags)
    @@ src/gpasswd.c: static void get_group (struct group *gr)
    -@@ src/gpasswd.c: static void get_group (struct group *gr)
    - 		if (sgr_close () == 0) {
    +@@ src/gpasswd.c: static void get_group (struct group *gr, struct option_flags *flags)
    + 		if (sgr_close (process_selinux) == 0) {
    @@ src/groupadd.c
    -@@ src/groupadd.c: static void close_files (void)
    +@@ src/groupadd.c: static void close_files (struct option_flags *flags)
    @@ src/groupadd.c: static void close_files (void)
    - 	cleanup_unlock_group (NULL);
    -@@ src/groupadd.c: static void close_files (void)
    + 	cleanup_unlock_group (&process_selinux);
    +@@ src/groupadd.c: static void close_files (struct option_flags *flags)
    @@ src/groupadd.c: static void close_files (void)
    - 		cleanup_unlock_gshadow (NULL);
    -@@ src/groupadd.c: static void close_files (void)
    + 		cleanup_unlock_gshadow (&process_selinux);
    +@@ src/groupadd.c: static void close_files (struct option_flags *flags)
    @@ src/groupadd.c: static void close_files (void)
    -@@ src/groupadd.c: static void open_files (void)
    +@@ src/groupadd.c: static void open_files (struct option_flags *flags)
    @@ src/groupadd.c: static void open_files (void)
    -@@ src/groupadd.c: static void open_files (void)
    +@@ src/groupadd.c: static void open_files (struct option_flags *flags)
    @@ src/groupdel.c
    -@@ src/groupdel.c: static void close_files (void)
    +@@ src/groupdel.c: static void close_files (struct option_flags *flags)
    @@ src/groupdel.c: static void close_files (void)
    - 	cleanup_unlock_group (NULL);
    -@@ src/groupdel.c: static void close_files (void)
    + 	cleanup_unlock_group (&process_selinux);
    +@@ src/groupdel.c: static void close_files (struct option_flags *flags)
    @@ src/groupdel.c: static void close_files (void)
    - 		cleanup_unlock_gshadow (NULL);
    -@@ src/groupdel.c: static void close_files (void)
    + 		cleanup_unlock_gshadow (&process_selinux);
    +@@ src/groupdel.c: static void close_files (struct option_flags *flags)
    @@ src/groupdel.c: static void close_files (void)
    -@@ src/groupdel.c: static void open_files (void)
    +@@ src/groupdel.c: static void open_files (struct option_flags *flags)
    @@ src/groupmems.c
    -@@ src/groupmems.c: static void check_perms (void)
    +@@ src/groupmems.c: static void check_perms (bool process_selinux)
    @@ src/groupmems.c: static void check_perms (void)
    -@@ src/groupmems.c: static void fail_exit (int code)
    +@@ src/groupmems.c: static void fail_exit (int code, bool process_selinux)
    @@ src/groupmems.c: static void fail_exit (int code)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/groupmems.c: static void fail_exit (int code)
    -@@ src/groupmems.c: static void fail_exit (int code)
    +@@ src/groupmems.c: static void fail_exit (int code, bool process_selinux)
    @@ src/groupmems.c: static void fail_exit (int code)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/groupmems.c: static void fail_exit (int code)
    -@@ src/groupmems.c: static void close_files (void)
    - {
    - 	if ((gr_close () == 0) && !list) {
    +@@ src/groupmems.c: static void close_files (struct option_flags *flags)
    + 
    + 	if ((gr_close (process_selinux) == 0) && !list) {
    @@ src/groupmems.c: static void close_files (void)
    - 		fail_exit (EXIT_GROUP_FILE);
    + 		fail_exit (EXIT_GROUP_FILE, process_selinux);
    @@ src/groupmems.c: static void close_files (void)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/groupmems.c: static void close_files (void)
    -@@ src/groupmems.c: static void close_files (void)
    +@@ src/groupmems.c: static void close_files (struct option_flags *flags)
    @@ src/groupmems.c: static void close_files (void)
    - 		if ((sgr_close () == 0) && !list) {
    + 		if ((sgr_close (process_selinux) == 0) && !list) {
    @@ src/groupmems.c: static void close_files (void)
    - 			fail_exit (EXIT_GROUP_FILE);
    + 			fail_exit (EXIT_GROUP_FILE, process_selinux);
    @@ src/groupmems.c: static void close_files (void)
    - 			if (sgr_unlock () == 0) {
    + 			if (sgr_unlock (process_selinux) == 0) {
    @@ src/groupmod.c
    -@@ src/groupmod.c: static void close_files (void)
    +@@ src/groupmod.c: static void close_files (struct option_flags *flags)
    @@ src/groupmod.c: static void close_files (void)
    - 	cleanup_unlock_group (NULL);
    -@@ src/groupmod.c: static void close_files (void)
    + 	cleanup_unlock_group (&process_selinux);
    +@@ src/groupmod.c: static void close_files (struct option_flags *flags)
    @@ src/groupmod.c: static void close_files (void)
    - 		cleanup_unlock_gshadow (NULL);
    -@@ src/groupmod.c: static void close_files (void)
    + 		cleanup_unlock_gshadow (&process_selinux);
    +@@ src/groupmod.c: static void close_files (struct option_flags *flags)
    @@ src/groupmod.c: static void close_files (void)
    - 		cleanup_unlock_passwd (NULL);
    + 		cleanup_unlock_passwd (&process_selinux);
    @@ src/grpck.c
    -@@ src/grpck.c: static void fail_exit (int status)
    +@@ src/grpck.c: static void fail_exit (int status, bool process_selinux)
    @@ src/grpck.c: static void fail_exit (int status)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/grpck.c: static void fail_exit (int status)
    -@@ src/grpck.c: static void fail_exit (int status)
    +@@ src/grpck.c: static void fail_exit (int status, bool process_selinux)
    @@ src/grpck.c: static void fail_exit (int status)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/grpck.c: static void fail_exit (int status)
    -@@ src/grpck.c: static void open_files (void)
    +@@ src/grpck.c: static void open_files (bool process_selinux)
    @@ src/grpck.c: static void open_files (void)
    - 		fail_exit (E_CANT_OPEN);
    + 		fail_exit (E_CANT_OPEN, process_selinux);
    @@ src/grpck.c: static void open_files (void)
    -@@ src/grpck.c: static void open_files (void)
    +@@ src/grpck.c: static void open_files (bool process_selinux)
    @@ src/grpck.c: static void open_files (void)
    - 		fail_exit (E_CANT_OPEN);
    + 		fail_exit (E_CANT_OPEN, process_selinux);
    @@ src/grpck.c: static void open_files (void)
    -@@ src/grpck.c: static void close_files (bool changed)
    +@@ src/grpck.c: static void close_files (bool changed, struct option_flags *flags)
    @@ src/grpck.c: static void close_files (bool changed)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/grpck.c: static void close_files (bool changed)
    -@@ src/grpck.c: static void close_files (bool changed)
    +@@ src/grpck.c: static void close_files (bool changed, struct option_flags *flags)
    @@ src/grpck.c: static void close_files (bool changed)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/grpck.c: static int check_members (const char *groupname,
    -@@ src/grpck.c: static void check_grp_file (bool *errors, bool *changed)
    +@@ src/grpck.c: static void check_grp_file (bool *errors, bool *changed, struct option_flags *fl
    @@ src/grpck.c: static void check_grp_file (bool *errors, bool *changed)
    -@@ src/grpck.c: static void check_grp_file (bool *errors, bool *changed)
    +@@ src/grpck.c: static void check_grp_file (bool *errors, bool *changed, struct option_flags *fl
    @@ src/grpconv.c
    -@@ src/grpconv.c: static void fail_exit (int status)
    +@@ src/grpconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/grpconv.c: static void fail_exit (int status)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/grpconv.c: static void fail_exit (int status)
    -@@ src/grpconv.c: static void fail_exit (int status)
    +@@ src/grpconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/grpconv.c: static void fail_exit (int status)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 	if (sgr_close () == 0) {
    + 	if (sgr_close (process_selinux) == 0) {
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 		fail_exit (3);
    + 		fail_exit (3, process_selinux);
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 	if (gr_close () == 0) {
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 		fail_exit (3);
    + 		fail_exit (3, process_selinux);
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 	if (sgr_unlock () == 0) {
    + 	if (sgr_unlock (process_selinux) == 0) {
    @@ src/grpconv.c: int main (int argc, char **argv)
    - 	if (gr_unlock () == 0) {
    + 	if (gr_unlock (process_selinux) == 0) {
    @@ src/grpunconv.c
    -@@ src/grpunconv.c: static void fail_exit (int status)
    +@@ src/grpunconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/grpunconv.c: static void fail_exit (int status)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/grpunconv.c: static void fail_exit (int status)
    -@@ src/grpunconv.c: static void fail_exit (int status)
    +@@ src/grpunconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/grpunconv.c: static void fail_exit (int status)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 	if (gr_close () == 0) {
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 		fail_exit (3);
    + 		fail_exit (3, process_selinux);
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 	if (unlink (SGROUP_FILE) != 0) {
    - 		eprintf(_("%s: cannot delete %s\n"), Prog, SGROUP_FILE);
    --		SYSLOG ((LOG_ERR, "cannot delete %s", SGROUP_FILE));
    + 	if (unlink(_PATH_GSHADOW) != 0) {
    + 		eprintf(_("%s: cannot delete %s\n"), Prog, _PATH_GSHADOW);
    +-		SYSLOG((LOG_ERR, "cannot delete %s", _PATH_GSHADOW));
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 		fail_exit (3);
    + 		fail_exit (3, process_selinux);
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 	if (gr_unlock () == 0) {
    + 	if (gr_unlock (process_selinux) == 0) {
    @@ src/grpunconv.c: int main (int argc, char **argv)
    - 	if (sgr_unlock () == 0) {
    + 	if (sgr_unlock (process_selinux) == 0) {
    @@ src/newusers.c
    -@@ src/newusers.c: static void fail_exit (int code)
    +@@ src/newusers.c: static void fail_exit (int code, bool process_selinux)
    @@ src/newusers.c: static void fail_exit (int code)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void fail_exit (int code)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void fail_exit (int code)
    -@@ src/newusers.c: static void fail_exit (int code)
    +@@ src/newusers.c: static void fail_exit (int code, bool process_selinux)
    @@ src/newusers.c: static void fail_exit (int code)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void fail_exit (int code)
    -@@ src/newusers.c: static void fail_exit (int code)
    +@@ src/newusers.c: static void fail_exit (int code, bool process_selinux)
    @@ src/newusers.c: static void fail_exit (int code)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void fail_exit (int code)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void fail_exit (int code)
    -@@ src/newusers.c: static void check_perms (void)
    +@@ src/newusers.c: static void check_perms (struct option_flags *flags)
    @@ src/newusers.c: static void check_perms (void)
    -@@ src/newusers.c: static void close_files (void)
    - {
    - 	if (pw_close () == 0) {
    +@@ src/newusers.c: static void close_files (struct option_flags *flags)
    + 
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void close_files (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    -@@ src/newusers.c: static void close_files (void)
    - 		if (spw_close () == 0) {
    +@@ src/newusers.c: static void close_files (struct option_flags *flags)
    + 		if (spw_close (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void close_files (void)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    -@@ src/newusers.c: static void close_files (void)
    - 	if (gr_close () == 0) {
    +@@ src/newusers.c: static void close_files (struct option_flags *flags)
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void close_files (void)
    - 	if (is_sub_uid  && (sub_uid_close () == 0)) {
    + 	if (is_sub_uid  && (sub_uid_close (process_selinux) == 0)) {
    @@ src/newusers.c: static void close_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void close_files (void)
    - 	if (is_sub_gid  && (sub_gid_close () == 0)) {
    + 	if (is_sub_gid  && (sub_gid_close (process_selinux) == 0)) {
    @@ src/newusers.c: static void close_files (void)
    - 		fail_exit (EXIT_FAILURE);
    + 		fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void close_files (void)
    - 	if (gr_unlock () == 0) {
    + 	if (gr_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    -@@ src/newusers.c: static void close_files (void)
    - 		if (sgr_close () == 0) {
    +@@ src/newusers.c: static void close_files (struct option_flags *flags)
    + 		if (sgr_close (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: static void close_files (void)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    -@@ src/newusers.c: static void close_files (void)
    +@@ src/newusers.c: static void close_files (struct option_flags *flags)
    @@ src/newusers.c: static void close_files (void)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/newusers.c: static void close_files (void)
    -@@ src/newusers.c: static void close_files (void)
    +@@ src/newusers.c: static void close_files (struct option_flags *flags)
    @@ src/newusers.c: static void close_files (void)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/passwd.c: static void check_password (const struct passwd *pw, const struct
    -@@ src/passwd.c: fail_exit (int status)
    +@@ src/passwd.c: fail_exit (int status, bool process_selinux)
    @@ src/passwd.c: fail_exit (int status)
    - 		if (pw_unlock () == 0) {
    - 			(void) eprintf(_("%s: failed to unlock %s\n"), Prog, pw_dbname());
    + 		if (pw_unlock (process_selinux) == 0) {
    + 			eprintf(_("%s: failed to unlock %s\n"), Prog, pw_dbname());
    @@ src/passwd.c: fail_exit (int status)
    -@@ src/passwd.c: fail_exit (int status)
    +@@ src/passwd.c: fail_exit (int status, bool process_selinux)
    @@ src/passwd.c: fail_exit (int status)
    - 		if (spw_unlock () == 0) {
    - 			(void) eprintf(_("%s: failed to unlock %s\n"), Prog, spw_dbname());
    + 		if (spw_unlock (process_selinux) == 0) {
    + 			eprintf(_("%s: failed to unlock %s\n"), Prog, spw_dbname());
    @@ src/passwd.c: fail_exit (int status)
    -@@ src/passwd.c: static void update_noshadow (void)
    +@@ src/passwd.c: static void update_noshadow (struct option_flags *flags)
    @@ src/passwd.c: static void update_noshadow (void)
    - 		fail_exit (E_MISSING);
    + 		fail_exit (E_MISSING, process_selinux);
    @@ src/passwd.c: static void update_noshadow (void)
    -@@ src/passwd.c: static void update_noshadow (void)
    - 	if (pw_close () == 0) {
    - 		(void) eprintf(_("%s: failure while writing changes to %s\n"),
    +@@ src/passwd.c: static void update_noshadow (struct option_flags *flags)
    + 	if (pw_close (process_selinux) == 0) {
    + 		eprintf(_("%s: failure while writing changes to %s\n"),
    @@ src/passwd.c: static void update_noshadow (void)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/passwd.c: static void update_noshadow (void)
    - 	if (pw_unlock () == 0) {
    - 		(void) eprintf(_("%s: failed to unlock %s\n"), Prog, pw_dbname());
    + 	if (pw_unlock (process_selinux) == 0) {
    + 		eprintf(_("%s: failed to unlock %s\n"), Prog, pw_dbname());
    @@ src/passwd.c: static void update_noshadow (void)
    -@@ src/passwd.c: static void update_shadow (void)
    +@@ src/passwd.c: static void update_shadow (struct option_flags *flags)
    @@ src/passwd.c: static void update_shadow (void)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/passwd.c: static void update_shadow (void)
    -@@ src/passwd.c: static void update_shadow (void)
    - 		if (spw_unlock () == 0) {
    - 			(void) eprintf(_("%s: failed to unlock %s\n"),
    +@@ src/passwd.c: static void update_shadow (struct option_flags *flags)
    + 		if (spw_unlock (process_selinux) == 0) {
    + 			eprintf(_("%s: failed to unlock %s\n"),
    @@ src/passwd.c: static void update_shadow (void)
    -@@ src/passwd.c: static void update_shadow (void)
    - 	if (spw_close () == 0) {
    - 		(void) eprintf(_("%s: failure while writing changes to %s\n"),
    +@@ src/passwd.c: static void update_shadow (struct option_flags *flags)
    + 	if (spw_close (process_selinux) == 0) {
    + 		eprintf(_("%s: failure while writing changes to %s\n"),
    @@ src/passwd.c: static void update_shadow (void)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/passwd.c: static void update_shadow (void)
    - 	if (spw_unlock () == 0) {
    - 		(void) eprintf(_("%s: failed to unlock %s\n"), Prog, spw_dbname());
    + 	if (spw_unlock (process_selinux) == 0) {
    + 		eprintf(_("%s: failed to unlock %s\n"), Prog, spw_dbname());
    @@ src/pwck.c
    -@@ src/pwck.c: static void fail_exit (int code)
    - 		if (spw_unlock () == 0) {
    +@@ src/pwck.c: static void fail_exit (int code, bool process_selinux)
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/pwck.c: static void fail_exit (int code)
    -@@ src/pwck.c: static void fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    +@@ src/pwck.c: static void fail_exit (int code, bool process_selinux)
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/pwck.c: static void fail_exit (int code)
    -@@ src/pwck.c: static void open_files (void)
    +@@ src/pwck.c: static void open_files (struct option_flags *flags)
    @@ src/pwck.c: static void open_files (void)
    - 		fail_exit (E_CANTOPEN);
    + 		fail_exit (E_CANTOPEN, process_selinux);
    @@ src/pwck.c: static void open_files (void)
    -@@ src/pwck.c: static void open_files (void)
    +@@ src/pwck.c: static void open_files (struct option_flags *flags)
    @@ src/pwck.c: static void open_files (void)
    - 			fail_exit (E_CANTOPEN);
    + 			fail_exit (E_CANTOPEN, process_selinux);
    @@ src/pwck.c: static void open_files (void)
    -@@ src/pwck.c: static void close_files (bool changed)
    +@@ src/pwck.c: static void close_files (bool changed, struct option_flags *flags)
    @@ src/pwck.c: static void close_files (bool changed)
    - 			fail_exit (E_CANTUPDATE);
    + 			fail_exit (E_CANTUPDATE, process_selinux);
    @@ src/pwck.c: static void close_files (bool changed)
    -@@ src/pwck.c: static void close_files (bool changed)
    +@@ src/pwck.c: static void close_files (bool changed, struct option_flags *flags)
    @@ src/pwck.c: static void close_files (bool changed)
    - 			fail_exit (E_CANTUPDATE);
    + 			fail_exit (E_CANTUPDATE, process_selinux);
    @@ src/pwck.c: static void close_files (bool changed)
    -@@ src/pwck.c: static void close_files (bool changed)
    +@@ src/pwck.c: static void close_files (bool changed, struct option_flags *flags)
    @@ src/pwck.c: static void close_files (bool changed)
    -@@ src/pwck.c: static void close_files (bool changed)
    +@@ src/pwck.c: static void close_files (bool changed, struct option_flags *flags)
    @@ src/pwck.c: static void close_files (bool changed)
    -@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    +@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed, struct option_flags *fla
    @@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    -@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    +@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed, struct option_flags *fla
    @@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    -@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    +@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed, struct option_flags *fla
    @@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    -@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed)
    +@@ src/pwck.c: static void check_pw_file (bool *errors, bool *changed, struct option_flags *fla
    @@ src/pwconv.c
    -@@ src/pwconv.c: static void fail_exit (int status)
    +@@ src/pwconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/pwconv.c: static void fail_exit (int status)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/pwconv.c: static void fail_exit (int status)
    -@@ src/pwconv.c: static void fail_exit (int status)
    +@@ src/pwconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/pwconv.c: static void fail_exit (int status)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 	if (spw_close () == 0) {
    + 	if (spw_close (process_selinux) == 0) {
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 	if (pw_close () == 0) {
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 		fail_exit (E_FAILURE);
    + 		fail_exit (E_FAILURE, process_selinux);
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/pwconv.c: int main (int argc, char **argv)
    - 	if (spw_unlock () == 0) {
    + 	if (spw_unlock (process_selinux) == 0) {
    @@ src/pwunconv.c
    -@@ src/pwunconv.c: static void fail_exit (int status)
    +@@ src/pwunconv.c: static void fail_exit (int status, bool process_selinux)
    @@ src/pwunconv.c: static void fail_exit (int status)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/pwunconv.c: static void fail_exit (int status)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 	if (pw_close () == 0) {
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 		fail_exit (3);
    + 		fail_exit (3, process_selinux);
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 		fail_exit (3);
    + 		fail_exit (3, process_selinux);
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 	if (spw_unlock () == 0) {
    + 	if (spw_unlock (process_selinux) == 0) {
    @@ src/pwunconv.c: int main (int argc, char **argv)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/useradd.c
    -@@ src/useradd.c: static void fail_exit (int code)
    +@@ src/useradd.c: static void fail_exit (int code, bool process_selinux)
    @@ src/useradd.c: static void fail_exit (int code)
    - 	if (spw_locked && spw_unlock() == 0) {
    + 	if (spw_locked && spw_unlock(process_selinux) == 0) {
    @@ src/useradd.c: static void fail_exit (int code)
    - 	if (pw_locked && pw_unlock() == 0) {
    + 	if (pw_locked && pw_unlock(process_selinux) == 0) {
    @@ src/useradd.c: static void fail_exit (int code)
    - 	if (gr_locked && gr_unlock() == 0) {
    + 	if (gr_locked && gr_unlock(process_selinux) == 0) {
    @@ src/useradd.c: static void fail_exit (int code)
    - 	if (sgr_locked && sgr_unlock() == 0) {
    + 	if (sgr_locked && sgr_unlock(process_selinux) == 0) {
    @@ src/useradd.c: static void fail_exit (int code)
    - 	if (sub_uid_locked && sub_uid_unlock() == 0) {
    + 	if (sub_uid_locked && sub_uid_unlock(process_selinux) == 0) {
    @@ src/useradd.c: static void fail_exit (int code)
    - 	if (sub_gid_locked && sub_gid_unlock() == 0) {
    + 	if (sub_gid_locked && sub_gid_unlock(process_selinux) == 0) {
    @@ src/useradd.c: static void fail_exit (int code)
    -@@ src/useradd.c: static void fail_exit (int code)
    +@@ src/useradd.c: static void fail_exit (int code, bool process_selinux)
    @@ src/useradd.c: set_defaults(void)
    -@@ src/useradd.c: static void grp_update (void)
    +@@ src/useradd.c: static void grp_update (bool process_selinux)
    @@ src/useradd.c: static void grp_update (void)
    - 			fail_exit (E_GRP_UPDATE);	/* XXX */
    + 			fail_exit (E_GRP_UPDATE, process_selinux);	/* XXX */
    @@ src/useradd.c: static void grp_update (void)
    -@@ src/useradd.c: static void grp_update (void)
    +@@ src/useradd.c: static void grp_update (bool process_selinux)
    @@ src/useradd.c: static void grp_update (void)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/useradd.c: static void grp_update (void)
    -@@ src/useradd.c: static void grp_update (void)
    +@@ src/useradd.c: static void grp_update (bool process_selinux)
    @@ src/useradd.c: static void grp_update (void)
    -@@ src/useradd.c: static void grp_update (void)
    +@@ src/useradd.c: static void grp_update (bool process_selinux)
    @@ src/useradd.c: static void grp_update (void)
    - 			fail_exit (E_GRP_UPDATE);	/* XXX */
    + 			fail_exit (E_GRP_UPDATE, process_selinux);	/* XXX */
    @@ src/useradd.c: static void grp_update (void)
    -@@ src/useradd.c: static void grp_update (void)
    +@@ src/useradd.c: static void grp_update (bool process_selinux)
    @@ src/useradd.c: static void grp_update (void)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/useradd.c: static void grp_update (void)
    -@@ src/useradd.c: static void grp_update (void)
    +@@ src/useradd.c: static void grp_update (bool process_selinux)
    @@ src/useradd.c: static void grp_update (void)
    -@@ src/useradd.c: static void close_files (void)
    - {
    - 	if (pw_close () == 0) {
    +@@ src/useradd.c: static void close_files (struct option_flags *flags)
    + 
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/useradd.c: static void close_files (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/useradd.c: static void close_files (void)
    - 	if (is_shadow_pwd && (spw_close () == 0)) {
    + 	if (is_shadow_pwd && (spw_close (process_selinux) == 0)) {
    @@ src/useradd.c: static void close_files (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/useradd.c: static void close_files (void)
    -@@ src/useradd.c: static void close_files (void)
    +@@ src/useradd.c: static void close_files (struct option_flags *flags)
    @@ src/useradd.c: static void close_files (void)
    - 	if (is_sub_uid  && (sub_uid_close () == 0)) {
    + 	if (is_sub_uid  && (sub_uid_close (process_selinux) == 0)) {
    @@ src/useradd.c: static void close_files (void)
    - 		fail_exit (E_SUB_UID_UPDATE);
    + 		fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/useradd.c: static void close_files (void)
    - 	if (is_sub_gid  && (sub_gid_close () == 0)) {
    + 	if (is_sub_gid  && (sub_gid_close (process_selinux) == 0)) {
    @@ src/useradd.c: static void close_files (void)
    - 		fail_exit (E_SUB_GID_UPDATE);
    + 		fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/useradd.c: static void close_files (void)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/useradd.c: static void close_files (void)
    -@@ src/useradd.c: static void close_files (void)
    +@@ src/useradd.c: static void close_files (struct option_flags *flags)
    @@ src/useradd.c: static void close_files (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/useradd.c: static void close_files (void)
    -@@ src/useradd.c: static void close_files (void)
    +@@ src/useradd.c: static void close_files (struct option_flags *flags)
    @@ src/useradd.c: static void close_files (void)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/useradd.c: static void close_files (void)
    -@@ src/useradd.c: static void close_files (void)
    +@@ src/useradd.c: static void close_files (struct option_flags *flags)
    @@ src/useradd.c: static void close_files (void)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/useradd.c: static void close_files (void)
    -@@ src/useradd.c: static void close_group_files (void)
    - 	if (gr_close() == 0) {
    +@@ src/useradd.c: static void close_group_files (bool process_selinux)
    + 	if (gr_close(process_selinux) == 0) {
    @@ src/useradd.c: static void close_group_files (void)
    - 		fail_exit(E_GRP_UPDATE);
    + 		fail_exit(E_GRP_UPDATE, process_selinux);
    @@ src/useradd.c: static void close_group_files (void)
    - 	if (is_shadow_grp && sgr_close() == 0) {
    + 	if (is_shadow_grp && sgr_close(process_selinux) == 0) {
    @@ src/useradd.c: static void close_group_files (void)
    - 		fail_exit(E_GRP_UPDATE);
    + 		fail_exit(E_GRP_UPDATE, process_selinux);
    @@ src/useradd.c: static void close_group_files (void)
    -@@ src/useradd.c: static void unlock_group_files (void)
    +@@ src/useradd.c: static void unlock_group_files (bool process_selinux)
    @@ src/useradd.c: static void unlock_group_files (void)
    - 	if (gr_unlock () == 0) {
    + 	if (gr_unlock (process_selinux) == 0) {
    @@ src/useradd.c: static void unlock_group_files (void)
    -@@ src/useradd.c: static void unlock_group_files (void)
    +@@ src/useradd.c: static void unlock_group_files (bool process_selinux)
    @@ src/useradd.c: static void unlock_group_files (void)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/useradd.c: static void unlock_group_files (void)
    -@@ src/useradd.c: static void grp_add (void)
    - 		fail_exit (E_GRP_UPDATE);
    +@@ src/useradd.c: static void grp_add (bool process_selinux)
    + 		fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/useradd.c: static void tallylog_reset (const char *user_name)
    -@@ src/useradd.c: static void usr_update (unsigned long subuid_count, unsigned long subgid_count)
    +@@ src/useradd.c: usr_update (unsigned long subuid_count, unsigned long subgid_count,
    @@ src/userdel.c
    -@@ src/userdel.c: static void update_groups (void)
    +@@ src/userdel.c: static void update_groups (bool process_selinux)
    @@ src/userdel.c: static void update_groups (void)
    -@@ src/userdel.c: static void update_groups (void)
    +@@ src/userdel.c: static void update_groups (bool process_selinux)
    @@ src/userdel.c: static void update_groups (void)
    -@@ src/userdel.c: static void remove_usergroup (void)
    +@@ src/userdel.c: static void remove_usergroup (bool process_selinux)
    @@ src/userdel.c: static void remove_usergroup (void)
    -@@ src/userdel.c: static void remove_usergroup (void)
    +@@ src/userdel.c: static void remove_usergroup (bool process_selinux)
    @@ src/userdel.c: static void remove_usergroup (void)
    -@@ src/userdel.c: static void close_files (void)
    - {
    - 	if (pw_close () == 0) {
    +@@ src/userdel.c: static void close_files (struct option_flags *flags)
    + 
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/userdel.c: static void close_files (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    -@@ src/userdel.c: static void close_files (void)
    +@@ src/userdel.c: static void close_files (struct option_flags *flags)
    @@ src/userdel.c: static void close_files (void)
    - 		if (spw_close () == 0) {
    + 		if (spw_close (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    - 			fail_exit (E_PW_UPDATE);
    + 			fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/userdel.c: static void close_files (void)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    -@@ src/userdel.c: static void close_files (void)
    +@@ src/userdel.c: static void close_files (struct option_flags *flags)
    @@ src/userdel.c: static void close_files (void)
    - 	if (gr_close () == 0) {
    + 	if (gr_close (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    - 		fail_exit (E_GRP_UPDATE);
    + 		fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/userdel.c: static void close_files (void)
    - 	if (gr_unlock () == 0) {
    + 	if (gr_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    -@@ src/userdel.c: static void close_files (void)
    +@@ src/userdel.c: static void close_files (struct option_flags *flags)
    @@ src/userdel.c: static void close_files (void)
    - 		if (sgr_close () == 0) {
    + 		if (sgr_close (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/userdel.c: static void close_files (void)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    -@@ src/userdel.c: static void close_files (void)
    +@@ src/userdel.c: static void close_files (struct option_flags *flags)
    @@ src/userdel.c: static void close_files (void)
    - 		if (sub_uid_close () == 0) {
    + 		if (sub_uid_close (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    - 			fail_exit (E_SUB_UID_UPDATE);
    + 			fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/userdel.c: static void close_files (void)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    -@@ src/userdel.c: static void close_files (void)
    +@@ src/userdel.c: static void close_files (struct option_flags *flags)
    @@ src/userdel.c: static void close_files (void)
    - 		if (sub_gid_close () == 0) {
    + 		if (sub_gid_close (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    - 			fail_exit (E_SUB_GID_UPDATE);
    + 			fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/userdel.c: static void close_files (void)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void close_files (void)
    -@@ src/userdel.c: static void fail_exit (int code)
    +@@ src/userdel.c: static void fail_exit (int code, bool process_selinux)
    @@ src/userdel.c: static void fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void fail_exit (int code)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void fail_exit (int code)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void fail_exit (int code)
    -@@ src/userdel.c: static void fail_exit (int code)
    +@@ src/userdel.c: static void fail_exit (int code, bool process_selinux)
    @@ src/userdel.c: static void fail_exit (int code)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void fail_exit (int code)
    -@@ src/userdel.c: static void fail_exit (int code)
    +@@ src/userdel.c: static void fail_exit (int code, bool process_selinux)
    @@ src/userdel.c: static void fail_exit (int code)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void fail_exit (int code)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/userdel.c: static void fail_exit (int code)
    -@@ src/userdel.c: static void update_user (void)
    +@@ src/userdel.c: static void update_user (bool process_selinux)
    @@ src/usermod.c: static char *new_pw_passwd (char *pw_pass)
    -@@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    +@@ src/usermod.c: static void new_pwent (struct passwd *pwent, bool process_selinux)
    @@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    -@@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    +@@ src/usermod.c: static void new_pwent (struct passwd *pwent, bool process_selinux)
    @@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    -@@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    +@@ src/usermod.c: static void new_pwent (struct passwd *pwent, bool process_selinux)
    @@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    -@@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    +@@ src/usermod.c: static void new_pwent (struct passwd *pwent, bool process_selinux)
    @@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    -@@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    +@@ src/usermod.c: static void new_pwent (struct passwd *pwent, bool process_selinux)
    @@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    -@@ src/usermod.c: static void new_spent (struct spwd *spent)
    +@@ src/usermod.c: static void new_spent (struct spwd *spent, bool process_selinux)
    @@ src/usermod.c: static void new_spent (struct spwd *spent)
    -@@ src/usermod.c: static void new_spent (struct spwd *spent)
    +@@ src/usermod.c: static void new_spent (struct spwd *spent, bool process_selinux)
    @@ src/usermod.c: static void new_spent (struct spwd *spent)
    -@@ src/usermod.c: fail_exit (int code)
    +@@ src/usermod.c: fail_exit (int code, bool process_selinux)
    @@ src/usermod.c: fail_exit (int code)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/usermod.c: fail_exit (int code)
    -@@ src/usermod.c: fail_exit (int code)
    +@@ src/usermod.c: fail_exit (int code, bool process_selinux)
    @@ src/usermod.c: fail_exit (int code)
    - 		if (sgr_unlock () == 0) {
    + 		if (sgr_unlock (process_selinux) == 0) {
    @@ src/usermod.c: fail_exit (int code)
    -@@ src/usermod.c: fail_exit (int code)
    +@@ src/usermod.c: fail_exit (int code, bool process_selinux)
    @@ src/usermod.c: fail_exit (int code)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/usermod.c: fail_exit (int code)
    - 		if (pw_unlock () == 0) {
    + 		if (pw_unlock (process_selinux) == 0) {
    @@ src/usermod.c: fail_exit (int code)
    -@@ src/usermod.c: fail_exit (int code)
    +@@ src/usermod.c: fail_exit (int code, bool process_selinux)
    @@ src/usermod.c: fail_exit (int code)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/usermod.c: fail_exit (int code)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/usermod.c: fail_exit (int code)
    -@@ src/usermod.c: update_group(const struct group *grp)
    +@@ src/usermod.c: update_group(const struct group *grp, bool process_selinux)
    @@ src/usermod.c: update_group(const struct group *grp)
    -@@ src/usermod.c: update_group(const struct group *grp)
    +@@ src/usermod.c: update_group(const struct group *grp, bool process_selinux)
    @@ src/usermod.c: update_group(const struct group *grp)
    -@@ src/usermod.c: update_group(const struct group *grp)
    +@@ src/usermod.c: update_group(const struct group *grp, bool process_selinux)
    @@ src/usermod.c: update_group(const struct group *grp)
    -@@ src/usermod.c: update_group(const struct group *grp)
    +@@ src/usermod.c: update_group(const struct group *grp, bool process_selinux)
    @@ src/usermod.c: update_group(const struct group *grp)
    - 		fail_exit (E_GRP_UPDATE);
    + 		fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/usermod.c: update_group(const struct group *grp)
    -@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    +@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp, bool process_selinux)
    @@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    -@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    +@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp, bool process_selinux)
    @@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    -@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    +@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp, bool process_selinux)
    @@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    -@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    +@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp, bool process_selinux)
    @@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    -@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    +@@ src/usermod.c: update_gshadow(const struct sgrp *sgrp, bool process_selinux)
    @@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    - 		fail_exit (E_GRP_UPDATE);
    + 		fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/usermod.c: update_gshadow(const struct sgrp *sgrp)
    -@@ src/usermod.c: static void close_files (void)
    - 	if (pw_close () == 0) {
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    + 	if (pw_close (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/usermod.c: static void close_files (void)
    - 	if (is_shadow_pwd && (spw_close () == 0)) {
    + 	if (is_shadow_pwd && (spw_close (process_selinux) == 0)) {
    @@ src/usermod.c: static void close_files (void)
    - 		fail_exit (E_PW_UPDATE);
    + 		fail_exit (E_PW_UPDATE, process_selinux);
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    - 		if (gr_close () == 0) {
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    + 		if (gr_close (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    - 			fail_exit (E_GRP_UPDATE);
    + 			fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    - 			if (sgr_close () == 0) {
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    + 			if (sgr_close (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    - 				fail_exit (E_GRP_UPDATE);
    + 				fail_exit (E_GRP_UPDATE, process_selinux);
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    - 			if (sgr_unlock () == 0) {
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    + 			if (sgr_unlock (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    - 		if (gr_unlock () == 0) {
    + 		if (gr_unlock (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    @@ src/usermod.c: static void close_files (void)
    - 		if (spw_unlock () == 0) {
    + 		if (spw_unlock (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    - 	if (pw_unlock () == 0) {
    + 	if (pw_unlock (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    @@ src/usermod.c: static void close_files (void)
    - 		if (sub_uid_close () == 0) {
    + 		if (sub_uid_close (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    - 			fail_exit (E_SUB_UID_UPDATE);
    + 			fail_exit (E_SUB_UID_UPDATE, process_selinux);
    @@ src/usermod.c: static void close_files (void)
    - 		if (sub_uid_unlock () == 0) {
    + 		if (sub_uid_unlock (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    -@@ src/usermod.c: static void close_files (void)
    +@@ src/usermod.c: static void close_files (struct option_flags *flags)
    @@ src/usermod.c: static void close_files (void)
    - 		if (sub_gid_close () == 0) {
    + 		if (sub_gid_close (process_selinux) == 0) {
    @@ src/usermod.c: static void close_files (void)
    - 			fail_exit (E_SUB_GID_UPDATE);
    + 			fail_exit (E_SUB_GID_UPDATE, process_selinux);
    @@ src/usermod.c: static void close_files (void)
    - 		if (sub_gid_unlock () == 0) {
    + 		if (sub_gid_unlock (process_selinux) == 0) {
    @@ src/vipw.c: static void vipwexit (const char *msg, int syserr, int ret)
    - 		if ((*unlock) () == 0) {
    + 		if ((*unlock) (true) == 0) {
    @@ src/vipw.c: static void vipwexit (const char *msg, int syserr, int ret)
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    - 	if ((*file_unlock) () == 0) {
    + 	if ((*file_unlock) (true) == 0) {
 7:  89a68bba =  7:  0d4af870 lib/: Move <syslog.h> wrappers to "io/syslog.h"
 8:  de8b9cd4 =  8:  d22e486c lib/io/syslog.h: SYSLOG_C(): Split code to helper macro
 9:  5cbca3af =  9:  aace99d5 lib/io/syslog.h: Rename local variable
10:  91bbde22 = 10:  0d718f3b lib/io/syslog.h: SYSLOG_C(): Use a single local variable
11:  e32447c6 = 11:  2d142ecf lib/io/syslog.h: SYSLOG_C(): Call setlocale(3) and free(3) unconditionally
12:  fa2d4762 = 12:  17a5a34a lib/io/fprintf/: [v]fprinte(): Add function
13:  d36ed519 = 13:  af7f8cb6 lib/io/fprintf/: [v]eprinte(): Add function
14:  0a0f2c23 ! 14:  9ae067f8 lib/, src/: Use eprinte() instead of its pattern
    @@ src/chage.c: int main (int argc, char **argv)
    - 		fail_exit (E_NOPERM);
    + 		fail_exit (E_NOPERM, process_selinux);
    @@ src/chgpasswd.c
    - #include "exitcodes.h"
    + #include "shadow/gshadow/sgrp.h"
    @@ src/chgpasswd.c
    - 
    + /*
    @@ src/chgpasswd.c: int main (int argc, char **argv)
    - 				fail_exit (1);
    + 				fail_exit (1, process_selinux);
    @@ src/chpasswd.c: int main (int argc, char **argv)
    - 				fail_exit (1);
    + 				fail_exit (1, process_selinux);
    @@ src/gpasswd.c
    - 
    - /*
    + struct option_flags {
    + 	bool chroot;
    @@ src/groupadd.c
    -@@ src/groupadd.c: static void open_files (void)
    +@@ src/groupadd.c: static void open_files (struct option_flags *flags)
    @@ src/groupadd.c: static void open_files (void)
    -@@ src/groupadd.c: static void open_files (void)
    +@@ src/groupadd.c: static void open_files (struct option_flags *flags)
    @@ src/newusers.c: int main (int argc, char **argv)
    - 			fail_exit (EXIT_FAILURE);
    + 			fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 				fail_exit (EXIT_FAILURE);
    + 				fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 					fail_exit (EXIT_FAILURE);
    + 					fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/newusers.c: int main (int argc, char **argv)
    - 				fail_exit (EXIT_FAILURE);
    + 				fail_exit (EXIT_FAILURE, process_selinux);
    @@ src/vipw.c
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
    @@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlo
    -@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
    +@@ src/vipw.c: vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
15:  350da966 = 15:  85698a10 lib/: Use [v]fprinte() instead of its pattern
16:  64d4993c = 16:  69dbc822 lib/io/syslog.h: SYSLOGE(): Add macro
17:  dfb25c6c = 17:  300e074d src/userdel.c: Fix error message
18:  3b1b87e4 ! 18:  65c2e9cc lib/, src/: Use SYSLOGE() instead of its pattern
    @@ src/groupadd.c
    -@@ src/groupadd.c: static void open_files (void)
    +@@ src/groupadd.c: static void open_files (struct option_flags *flags)
    @@ src/groupadd.c: static void open_files (void)
    -@@ src/groupadd.c: static void open_files (void)
    +@@ src/groupadd.c: static void open_files (struct option_flags *flags)

@alejandro-colomar alejandro-colomar force-pushed the eprintf branch 2 times, most recently from 86ca0d6 to b3f573b Compare October 19, 2025 14:32
@alejandro-colomar alejandro-colomar marked this pull request as draft October 24, 2025 07:28
@alejandro-colomar alejandro-colomar changed the title Add and use eprintf() and strerrno(), and de-weirdify SYSLOG(()) Add and use eprintf() and eprinte(), and de-weirdify SYSLOG(()) Oct 24, 2025
@alejandro-colomar alejandro-colomar changed the title Add and use eprintf() and eprinte(), and de-weirdify SYSLOG(()) Add and use eprintf(), fprinte(), and eprinte(), and de-weirdify SYSLOG(()) Oct 24, 2025
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
This will allow having shorter lines for writing to stderr.

This name is commonly used in other projects, it seems (see link below).

Link: <https://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/Variadic-Macros.html>
Signed-off-by: Alejandro Colomar <[email protected]>
The double parentheses were used to fake a variadic macro with a
non-variadic one.  With a variadic macro, we remove the weird double
parentheses that were needed to call this macro, which BTW were
error-prone (see the bug fixed in the previous commit).

Signed-off-by: Alejandro Colomar <[email protected]>
The name of this macro makes it more evident what it does.  It's a
C-locale version of syslog(3).  We need to implement it as a macro
so that arguments such as strerror(3) are evaluated after setting
the C locale.  This would be impossible with a function.

Signed-off-by: Alejandro Colomar <[email protected]>
There's no need for two variables, and this avoids one assignment.

Signed-off-by: Alejandro Colomar <[email protected]>
…nally

Both setlocale(3) and free(3) are okay to call with a null pointer.

Signed-off-by: Alejandro Colomar <[email protected]>
This function preserves errno, so that a following syslog(3) call still
has the previous errno value.

Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Having such long and complex format strings and variadic arguments is
error-prone, as can be seen in the previous commit, which fixes a bug of
this kind.

Signed-off-by: Alejandro Colomar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing closing parenthesis in syslog(3) call Writing to wrong stream

2 participants