]> git.cameronkatri.com Git - pw-darwin.git/commitdiff
pw: (file == NULL) check is always false in read_userconfig(), remove
authorYuri Pankov <yuripv@FreeBSD.org>
Tue, 16 Oct 2018 16:00:41 +0000 (16:00 +0000)
committerYuri Pankov <yuripv@FreeBSD.org>
Tue, 16 Oct 2018 16:00:41 +0000 (16:00 +0000)
it.  Drop the now unused _PATH_PW_CONF definition. [1]

While here, change the last remaining hardcoded "/etc" to _PATH_PWD.

Noted by: glebius [1]
Reviewed by: eugen
Approved by: re (gjb), kib (mentor)
Differential Revision: https://reviews.freebsd.org/D17575

pw/pw.c
pw/pw.h
pw/pw_conf.c

diff --git a/pw/pw.c b/pw/pw.c
index 5f02a1513651f4548353158f5ca5cf816b1dd1c7..4f92034a5d2086d6d6219dc509c2702acf123db6 100644 (file)
--- a/pw/pw.c
+++ b/pw/pw.c
@@ -162,7 +162,8 @@ main(int argc, char *argv[])
                                        PWF._altdir = PWF_ROOTDIR;
                                }
                                snprintf(conf.etcpath, sizeof(conf.etcpath),
-                                   "%s%s", optarg, arg == 'R' ? "/etc" : "");
+                                   "%s%s", optarg, arg == 'R' ?
+                                   _PATH_PWD : "");
                        } else
                                break;
                }
diff --git a/pw/pw.h b/pw/pw.h
index d5e2c600079f141aac0a4c48a7a987e26b8fc7fc..1e09722a907c77abee55a0a320299c04781f4e36 100644 (file)
--- a/pw/pw.h
+++ b/pw/pw.h
@@ -65,7 +65,6 @@ enum _which
 
 #define        _DEF_DIRMODE    (S_IRWXU | S_IRWXG | S_IRWXO)
 #define        _PW_CONF        "pw.conf"
-#define _PATH_PW_CONF  "/etc/pw.conf"
 #define _UC_MAXLINE    1024
 #define _UC_MAXSHELLS  32
 
index f7b98f188f7767a5cf6632e5b2e82782a6e7ca03..9dff3fe03efaf7590af404548777cfc5fd298fde 100644 (file)
@@ -255,9 +255,6 @@ read_userconfig(char const * file)
        buf = NULL;
        linecap = 0;
 
-       if (file == NULL)
-               file = _PATH_PW_CONF;
-
        if ((fp = fopen(file, "r")) == NULL)
                return (&config);