From: Jim Meyering Date: Sun, 15 Aug 1999 12:56:00 +0000 (+0000) Subject: (ENOSYS): Define to a bogus value if not already defined. X-Git-Tag: FILEUTILS-4_0j-trial~349 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7228350401c5f304f32e7e64873da83e40f3410f;p=thirdparty%2Fcoreutils.git (ENOSYS): Define to a bogus value if not already defined. (parse_options): Warn if --pid=PID is used and kill() returns ENOSYS (e.g. when compiled with DJGPP). --- diff --git a/src/tail.c b/src/tail.c index b1b4b44902..40ce9f02aa 100644 --- a/src/tail.c +++ b/src/tail.c @@ -51,6 +51,12 @@ # define OFF_T_MAX TYPE_MAXIMUM (off_t) #endif +#ifndef ENOSYS + /* Some systems don't have ENOSYS -- this should be a big enough + value that no valid errno value will match it. */ +# define ENOSYS 99999 +#endif + /* Number of items to tail. */ #define DEFAULT_N_LINES 10 @@ -1435,6 +1441,11 @@ parse_options (int argc, char **argv, if (pid && !forever) error (0, 0, _("warning: PID ignored; --pid=PID is useful only when following")); + else if (pid && kill (pid, 0) != 0 && errno == ENOSYS) + { + error (0, 0, _("warning: --pid=PID is not supported on this system")); + pid = 0; + } } int