[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
finger & pinky commands reports improper exit status
From: |
Halesh S |
Subject: |
finger & pinky commands reports improper exit status |
Date: |
Thu, 3 Jul 2008 14:25:57 +0530 |
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
- finger & pinky commands reports improper exit status,
Halesh S <=