]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
pinky,who: remove redeclarations of ttyname
authorGeorge Burgess IV <gbiv@chromium.org>
Sat, 10 Sep 2016 06:43:19 +0000 (23:43 -0700)
committerPádraig Brady <P@draigBrady.com>
Sun, 11 Sep 2016 11:46:02 +0000 (12:46 +0100)
Given that `ttyname` is already conditionally declared in src/system.h,
other declarations are redundant and problematic for example in ChromeOS
which has a new FORTIFY implementation that, as an artifact of how it's
implemented, causes the compiler to complain if certain standard library
functions are redeclared without special compiler-specific attributes.

* src/pinky.c: Remove declaration (which was unused anyway).
* src/who.c: Remove declaration.
* src/system.h (getlogin, getuid, geteuid, getgrgid, getpwuid, ttyname):
Add the parameter type to the declarations to avoid warnings when these
backup declarations are used.

src/pinky.c
src/system.h
src/who.c

index 68566fdc233ed2777b4992379d4e13c0b89148e5..76856090a4ecab0df55939fb2a585182ca1a3c60 100644 (file)
@@ -37,8 +37,6 @@
   proper_name ("David MacKenzie"), \
   proper_name ("Kaveh Ghazi")
 
-char *ttyname (int);
-
 /* If true, display the hours:minutes since each user has touched
    the keyboard, or blank if within the last minute, or days followed
    by a 'd' if not within the last day. */
index 986a6c7869ebb02edef814b2abfb6c6b0586fa04..1b7a0fbb3d44deb12846ce0a49290bc14222d4f8 100644 (file)
@@ -197,23 +197,23 @@ select_plural (uintmax_t n)
 #define STRNCMP_LIT(s, lit) strncmp (s, "" lit "", sizeof (lit) - 1)
 
 #if !HAVE_DECL_GETLOGIN
-char *getlogin ();
+char *getlogin (void);
 #endif
 
 #if !HAVE_DECL_TTYNAME
-char *ttyname ();
+char *ttyname (int);
 #endif
 
 #if !HAVE_DECL_GETEUID
-uid_t geteuid ();
+uid_t geteuid (void);
 #endif
 
 #if !HAVE_DECL_GETPWUID
-struct passwd *getpwuid ();
+struct passwd *getpwuid (uid_t);
 #endif
 
 #if !HAVE_DECL_GETGRGID
-struct group *getgrgid ();
+struct group *getgrgid (gid_t);
 #endif
 
 /* Interix has replacements for getgr{gid,nam,ent}, that don't
@@ -235,7 +235,7 @@ struct group *getgrgid ();
 #endif
 
 #if !HAVE_DECL_GETUID
-uid_t getuid ();
+uid_t getuid (void);
 #endif
 
 #include "xalloc.h"
index c6fc4dc4baca39d63c6645d8a81dc0cea97494cb..f56c71833210375e6b4a10ab6e02b84c7789171a 100644 (file)
--- a/src/who.c
+++ b/src/who.c
@@ -96,8 +96,6 @@
 # define UT_ID(U) "??"
 #endif
 
-char *ttyname (int);
-
 /* If true, attempt to canonicalize hostnames via a DNS lookup. */
 static bool do_lookup;