xfunc: fix: && -> &. Also nuked two double semicolons...
[oweals/busybox.git] / loginutils / passwd.c
index 5b828dfeedc96b8e50638ec6851abb2c4ce47c0f..aa75dd260fa73cc6db133391592de84051216f7e 100644 (file)
@@ -3,20 +3,8 @@
  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
 
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <utime.h>
-#include <syslog.h>
-#include <time.h>
-#include <sys/resource.h>
-#include <errno.h>
-
 #include "busybox.h"
+#include <syslog.h>
 
 static char crypt_passwd[128];
 
@@ -170,7 +158,7 @@ int passwd_main(int argc, char **argv)
                        bb_show_usage();
                }
        }
-       myname = (char *) bb_xstrdup(bb_getpwuid(NULL, getuid(), -1));
+       myname = (char *) xstrdup(bb_getpwuid(NULL, getuid(), -1));
        /* exits on error */
        if (optind < argc) {
                name = argv[optind];
@@ -227,10 +215,7 @@ int passwd_main(int argc, char **argv)
        signal(SIGINT, SIG_IGN);
        signal(SIGQUIT, SIG_IGN);
        umask(077);
-       if (setuid(0)) {
-               syslog(LOG_ERR, "can't setuid(0)");
-               bb_error_msg_and_die( "Cannot change ID to root.\n");
-       }
+       xsetuid(0);
        if (!update_passwd(pw, crypt_passwd)) {
                syslog(LOG_INFO, "password for `%s' changed by user `%s'", name,
                           myname);