From c9524a9c25a9129aa298fb50d693c24ff62de11e Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Fri, 7 Jul 1995 03:11:24 +0000 Subject: (main, apply_auth_to_loginid, apply_auth_to_pgrp): Remove assignments from inside if tests. --- utils/su.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'utils') diff --git a/utils/su.c b/utils/su.c index 1772a377..374696b5 100644 --- a/utils/su.c +++ b/utils/su.c @@ -1,5 +1,5 @@ /* `su' for GNU Hurd. - Copyright (C) 1994 Free Software Foundation + Copyright (C) 1994, 1995 Free Software Foundation Written by Roland McGrath. This file is part of the GNU Hurd. @@ -163,12 +163,15 @@ main (int argc, char **argv) auth[authidx++].ids = get_user ("root"); if (pididx == 0 && loginidx == 0 && pgrpidx == 0) - /* No processes specified; default is current login collection. */ - if (errno = proc_getloginid (proc, getpid (), &loginids[loginidx++])) - { - perror ("proc_getloginid"); - return 1; - } + { + /* No processes specified; default is current login collection. */ + errno = proc_getloginid (proc, getpid (), &loginids[loginidx++]); + if (errno) + { + perror ("proc_getloginid"); + return 1; + } + } status = 0; @@ -176,12 +179,11 @@ main (int argc, char **argv) for (i = 0; i < authidx; ++i) { struct auth *a = &auth[i]; - if (errno = auth_makeauth (getauth (), - NULL, MACH_MSG_TYPE_COPY_SEND, 0, - &a->ids[1], a->ids[0], NULL, 0, - &a->ids[1 + a->ids[0] + 1], - a->ids[1 + a->ids[0]], NULL, 0, - &a->authport)) + errno = auth_makeauth (getauth (), NULL, MACH_MSG_TYPE_COPY_SEND, 0, + &a->ids[1], a->ids[0], NULL, 0, + &a->ids[1 + a->ids[0] + 1], + a->ids[1 + a->ids[0]], NULL, 0, &a->authport); + if (errno) { perror ("auth_makeauth"); status = 1; @@ -403,7 +405,8 @@ apply_auth_to_loginid (struct auth *auth, int loginid) int status; error_t err; - if (err = proc_getloginpids (proc, loginid, &pids, &npids)) + err = proc_getloginpids (proc, loginid, &pids, &npids); + if (err) { fprintf (stderr, "%s: proc_getloginpids failed for loginid %d: %s\n", program_invocation_short_name, loginid, strerror (err)); @@ -427,7 +430,8 @@ apply_auth_to_pgrp (struct auth *auth, pid_t pgrp) int status; error_t err; - if (err = proc_getpgrppids (proc, pgrp, &pids, &npids)) + err = proc_getpgrppids (proc, pgrp, &pids, &npids); + if (err) { fprintf (stderr, "%s: proc_getpgrppids failed for pgrp %d: %s\n", program_invocation_short_name, pgrp, strerror (err)); -- cgit v1.2.3