]> granicus.if.org Git - shadow/commitdiff
* src/chage.c: Use a bool when possible instead of int integers.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Tue, 10 Jun 2008 17:56:53 +0000 (17:56 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Tue, 10 Jun 2008 17:56:53 +0000 (17:56 +0000)
* src/chage.c: Ignore return value of setlocale(),
bindtextdomain(), and textdomain().

ChangeLog
src/chage.c

index ae35f2b7389b043de928adf4764c7cd5363a1bf8..8d4a785b98c5c1d0afb3cd2ca744b92244b2e1cd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-10  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/chage.c: Use a bool when possible instead of int integers.
+       * src/chage.c: Ignore return value of setlocale(),
+       bindtextdomain(), and textdomain().
+
 2008-06-10  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/groupadd.c: Use a bool when possible instead of int
index 27e60fd947c7b4b70d912aa77bbb5b787d8cf508..51e66bee1c9d004dafe51a679329f6d346e8ee61 100644 (file)
  */
 static char *Prog;
 
-static int
dflg = 0,                     /* set last password change date */
-    Eflg = 0,                  /* set account expiration date */
-    Iflg = 0,                  /* set password inactive after expiration */
-    lflg = 0,                  /* show account aging information */
-    mflg = 0,                  /* set minimum number of days before password change */
-    Mflg = 0,                  /* set maximum number of days before password change */
-    Wflg = 0;                  /* set expiration warning days */
-static int amroot = 0;
-
-static int pw_locked = 0;      /* Indicate if the password file is locked */
-static int spw_locked = 0;     /* Indicate if the shadow file is locked */
+static bool
   dflg = false,              /* set last password change date */
+    Eflg = false,              /* set account expiration date */
+    Iflg = false,              /* set password inactive after expiration */
+    lflg = false,              /* show account aging information */
+    mflg = false,              /* set minimum number of days before password change */
+    Mflg = false,              /* set maximum number of days before password change */
+    Wflg = false;              /* set expiration warning days */
+static bool amroot = false;
+
+static bool pw_locked  = false;        /* Indicate if the password file is locked */
+static bool spw_locked = false;        /* Indicate if the shadow file is locked */
 /* The name and UID of the user being worked on */
 static char user_name[BUFSIZ] = "";
 static uid_t user_uid = -1;
@@ -90,7 +90,7 @@ static pam_handle_t *pamh = NULL;
 #define        EPOCH           "1969-12-31"
 
 /* local function prototypes */
-static int isnum (const char *s);
+static bool isnum (const char *s);
 static void usage (void);
 static void date_to_str (char *, size_t, time_t);
 static int new_fields (void);
@@ -99,7 +99,7 @@ static void list_fields (void);
 static void process_flags (int argc, char **argv);
 static void check_flags (int argc, int opt_index);
 static void check_perms (void);
-static void open_files (int readonly);
+static void open_files (bool readonly);
 static void close_files (void);
 static void fail_exit (int code);
 
@@ -139,15 +139,15 @@ static void fail_exit (int code)
 /*
  * isnum - determine whether or not a string is a number
  */
-static int isnum (const char *s)
+static bool isnum (const char *s)
 {
        while ('\0' != *s) {
                if (!isdigit (*s)) {
-                       return 0;
+                       return false;
                }
                s++;
        }
-       return 1;
+       return true;
 }
 
 /*
@@ -394,7 +394,7 @@ static void process_flags (int argc, char **argv)
                             &option_index)) != -1) {
                switch (c) {
                case 'd':
-                       dflg++;
+                       dflg = true;
                        if (!isnum (optarg)) {
                                lastday = strtoday (optarg);
                        } else {
@@ -402,7 +402,7 @@ static void process_flags (int argc, char **argv)
                        }
                        break;
                case 'E':
-                       Eflg++;
+                       Eflg = true;
                        if (!isnum (optarg)) {
                                expdays = strtoday (optarg);
                        } else {
@@ -413,22 +413,22 @@ static void process_flags (int argc, char **argv)
                        usage ();
                        break;
                case 'I':
-                       Iflg++;
+                       Iflg = true;
                        inactdays = strtol (optarg, 0, 10);
                        break;
                case 'l':
-                       lflg++;
+                       lflg = true;
                        break;
                case 'm':
-                       mflg++;
+                       mflg = true;
                        mindays = strtol (optarg, 0, 10);
                        break;
                case 'M':
-                       Mflg++;
+                       Mflg = true;
                        maxdays = strtol (optarg, 0, 10);
                        break;
                case 'W':
-                       Wflg++;
+                       Wflg = true;
                        warndays = strtol (optarg, 0, 10);
                        break;
                default:
@@ -535,7 +535,7 @@ static void check_perms (void)
  *     In read-only mode, the databases are not locked and are opened
  *     only for reading.
  */
-static void open_files (int readonly)
+static void open_files (bool readonly)
 {
        /*
         * Lock and open the password file. This loads all of the password
@@ -549,7 +549,7 @@ static void open_files (int readonly)
                fail_exit (E_NOPERM);
        }
        if (!readonly) {
-               pw_locked = 1;
+               pw_locked = true;
        }
        if (pw_open (readonly ? O_RDONLY: O_RDWR) == 0) {
                fprintf (stderr, _("%s: can't open password file\n"), Prog);
@@ -570,7 +570,7 @@ static void open_files (int readonly)
                fail_exit (E_NOPERM);
        }
        if (!readonly) {
-               spw_locked = 1;
+               spw_locked = true;
        }
        if (spw_open (readonly ? O_RDONLY: O_RDWR) == 0) {
                fprintf (stderr,
@@ -606,9 +606,9 @@ static void close_files (void)
                fail_exit (E_NOPERM);
        }
        spw_unlock ();
-       spw_locked = 0;
+       spw_locked = false;
        pw_unlock ();
-       pw_locked = 0;
+       pw_locked = false;
 }
 
 /*
@@ -753,9 +753,9 @@ int main (int argc, char **argv)
        audit_help_open ();
 #endif
        sanitize_env ();
-       setlocale (LC_ALL, "");
-       bindtextdomain (PACKAGE, LOCALEDIR);
-       textdomain (PACKAGE);
+       (void) setlocale (LC_ALL, "");
+       (void) bindtextdomain (PACKAGE, LOCALEDIR);
+       (void) textdomain (PACKAGE);
 
        ruid = getuid ();
        rgid = getgid ();