summaryrefslogtreecommitdiffstats
path: root/login-utils/su.c
diff options
context:
space:
mode:
authorKarel Zak2012-05-29 12:53:46 +0200
committerKarel Zak2012-05-29 12:53:46 +0200
commit7149efa8a483cdaffd95a83dfeaef253a41a7118 (patch)
treed67cbc79df0fc5ca143d83397993a93e29c78b4c /login-utils/su.c
parentsu: fix compiler warning [-Wunused-parameter] (diff)
downloadkernel-qcow2-util-linux-7149efa8a483cdaffd95a83dfeaef253a41a7118.tar.gz
kernel-qcow2-util-linux-7149efa8a483cdaffd95a83dfeaef253a41a7118.tar.xz
kernel-qcow2-util-linux-7149efa8a483cdaffd95a83dfeaef253a41a7118.zip
su: remove program_name
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/su.c')
-rw-r--r--login-utils/su.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/login-utils/su.c b/login-utils/su.c
index 96486c269..0e8963233 100644
--- a/login-utils/su.c
+++ b/login-utils/su.c
@@ -65,16 +65,14 @@ enum
#include "error.h"
#include <stdbool.h>
+#include "c.h"
#include "xalloc.h"
#include "nls.h"
#include "pathnames.h"
-/* The official name of this program (e.g., no `g' prefix). */
-#define PROGRAM_NAME "su"
-
/* name of the pam configuration files. separate configs for su and su - */
-#define PAM_SERVICE_NAME PROGRAM_NAME
-#define PAM_SERVICE_NAME_L PROGRAM_NAME "-l"
+#define PAM_SERVICE_NAME "su"
+#define PAM_SERVICE_NAME_L "su-l"
#include "logindefs.h"
@@ -89,9 +87,6 @@ extern char **environ;
static void run_shell (char const *, char const *, char **, size_t)
__attribute__ ((__noreturn__));
-/* The name this program was run with. */
-char *program_name;
-
/* If true, pass the `-f' option to the subshell. */
static bool fast_startup;
@@ -161,7 +156,7 @@ log_su (struct passwd const *pw, bool successful)
if (!tty)
tty = "none";
- openlog (basename (program_name), 0 , LOG_AUTH);
+ openlog (program_invocation_short_name, 0 , LOG_AUTH);
syslog (LOG_NOTICE, "%s(to %s) %s on %s",
successful ? "" : "FAILED SU ",
new_user, old_user, tty);
@@ -654,10 +649,10 @@ usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
- program_name);
+ program_invocation_short_name);
else
{
- printf (_("Usage: %s [OPTION]... [-] [USER [ARG]...]\n"), program_name);
+ printf (_("Usage: %s [OPTION]... [-] [USER [ARG]...]\n"), program_invocation_short_name);
fputs (_("\
Change the effective user id and group id to that of USER.\n\
\n\
@@ -697,7 +692,6 @@ main (int argc, char **argv)
struct passwd *pw;
struct passwd pw_copy;
- program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);