[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: finger & pinky commands reports improper exit status
From: |
Halesh S |
Subject: |
Re: finger & pinky commands reports improper exit status |
Date: |
Fri, 4 Jul 2008 10:08:01 +0530 |
The last patch has missied for no-args.
The attached patch will fix the issue.
Thanks,
Halesh
n 7/3/08, Halesh S <address@hidden> wrote:
> Test 1:
> ----------
> $ finger <some-user>
> finger: 1: no such user.
> $echo $?
> 0
>
> Test 2:
> ----------
> $pinky <some-user>
> Login Name TTY Idle When Where
> $echo $?
> 0
>
> Verified in coreutils-6.9
>
> Patch to fix the issue in pinky(1)
> ============================
> --- old.src/pinky.c 2008-07-03 12:48:49.000000000 +0530
> +++ src/pinky.c 2008-07-03 12:48:18.000000000 +0530
> @@ -438,6 +438,7 @@
> scan_entries (size_t n, const STRUCT_UTMP *utmp_buf,
> const int argc_names, char *const argv_names[])
> {
> + int not_found_flg = 1;
> if (hard_locale (LC_TIME))
> {
> time_format = "%Y-%m-%d %H:%M";
> @@ -464,6 +465,7 @@
> if (strncmp (UT_USER (utmp_buf), argv_names[i], UT_USER_SIZE)
> == 0)
> {
> + not_found_flg = 0;
> print_entry (utmp_buf);
> break;
> }
> @@ -473,6 +475,12 @@
> }
> utmp_buf++;
> }
> + if (not_found_flg)
> + {
> + fprintf (stderr, _("no user found.\n"),
> + program_name);
> + exit(1);
> + }
> }
>
> /* Display a list of who is on the system, according to utmp file FILENAME.
> */
> ===================================
>
> After applaying patch
>
> Test 2
> ---------
> $pinky <some-user>
> Login Name TTY Idle When Where
> no user found.
> $echo $?
> 1
>
> Thanks,
>
> Halesh
>
pinky.c.patch
Description: Binary data