pw: (file == NULL) check is always false in read_userconfig(), remove

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
This commit is contained in:
Yuri Pankov 2018-10-16 16:00:41 +00:00
parent 47f1ea5109
commit 4835c3b1df
3 changed files with 2 additions and 5 deletions

View File

@ -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;
}

View File

@ -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

View 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);