summaryrefslogtreecommitdiffstats
path: root/login-utils
diff options
context:
space:
mode:
authorKarel Zak2019-05-20 12:57:39 +0200
committerKarel Zak2019-05-20 12:57:39 +0200
commit124a903002b5a42e822509e9f6a9f05696113192 (patch)
tree07508afa50fb5ee6aaa8c529a6854291a9e599a7 /login-utils
parentlib/path: use xstrncpy() (diff)
downloadkernel-qcow2-util-linux-124a903002b5a42e822509e9f6a9f05696113192.tar.gz
kernel-qcow2-util-linux-124a903002b5a42e822509e9f6a9f05696113192.tar.xz
kernel-qcow2-util-linux-124a903002b5a42e822509e9f6a9f05696113192.zip
vipw: use xstrncpy()
It's already used by vipw, so use it everywhere. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils')
-rw-r--r--login-utils/vipw.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/login-utils/vipw.c b/login-utils/vipw.c
index 2b35036e6..a071b639d 100644
--- a/login-utils/vipw.c
+++ b/login-utils/vipw.c
@@ -335,7 +335,7 @@ int main(int argc, char *argv[])
xstrncpy(orig_file, PASSWD_FILE, sizeof(orig_file));
}
- while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
+ while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1) {
switch (c) {
case 'V':
print_version(EXIT_SUCCESS);
@@ -344,14 +344,14 @@ int main(int argc, char *argv[])
default:
errtryhelp(EXIT_FAILURE);
}
+ }
edit_file(0);
- if (program == VIGR) {
- strncpy(orig_file, SGROUP_FILE, FILENAMELEN - 1);
- } else {
- strncpy(orig_file, SHADOW_FILE, FILENAMELEN - 1);
- }
+ if (program == VIGR)
+ xstrncpy(orig_file, SGROUP_FILE, sizeof(orig_file));
+ else
+ xstrncpy(orig_file, SHADOW_FILE, sizeof(orig_file));
if (access(orig_file, F_OK) == 0) {
char response[80];