]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - login-utils/chfn.c
Imported from util-linux-2.11o tarball.
[thirdparty/util-linux.git] / login-utils / chfn.c
index de228241b872af1403a1a093fd37051e2e23fcf8..7c6bfac05e69426399c513f45df2cb569d247877 100644 (file)
@@ -16,7 +16,7 @@
  * Hacked by Peter Breitenlohner, peb@mppmu.mpg.de,
  * to remove trailing empty fields.  Oct 5, 96.
  *
- *  1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+ *  1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
  *  - added Native Language Support
  *    
  *
@@ -36,6 +36,7 @@
 #include "my_crypt.h"
 #include "islocal.h"
 #include "setpwnam.h"
+#include "xstrncpy.h"
 #include "nls.h"
 #include "env.h"
 
@@ -220,7 +221,7 @@ static boolean parse_argv (argc, argv, pinfo)
     info_given = false;
     while (true) {
        c = getopt_long (argc, argv, "f:r:p:h:o:uv", long_options, &index);
-       if (c == EOF) break;
+       if (c == -1) break;
        /* version?  output version and exit. */
        if (c == 'v') {
            printf ("%s\n", util_linux_version);
@@ -239,8 +240,7 @@ static boolean parse_argv (argc, argv, pinfo)
        info_given = true;
        status = 0;
 
-       strncpy (buf, whoami, sizeof(buf)-128); 
-       buf[sizeof(buf)-128-1] = 0;
+       xstrncpy (buf, whoami, sizeof(buf)-128); 
        strcat (buf, ": ");
 
        /* now store the argument */