X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=loginutils%2Fpasswd.c;h=aa75dd260fa73cc6db133391592de84051216f7e;hb=d25a2645f5273e70616abe73e6ac1adda5016532;hp=5b828dfeedc96b8e50638ec6851abb2c4ce47c0f;hpb=801ab140132a111e9524371c9b8d425579692389;p=oweals%2Fbusybox.git diff --git a/loginutils/passwd.c b/loginutils/passwd.c index 5b828dfee..aa75dd260 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c @@ -3,20 +3,8 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "busybox.h" +#include 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);