From: Andrew Oates <[email protected]>

Change #1: The current version doesn't compile when HAVE_GETHOSTNAME is
undefined, because the type of the declaration doesn't match the
definition in oslib.c (which is correct).  This updates the declaration
to match the implementation, as well as the POSIX spec for it.  Add decl
for killpg when HAVE_KILLPG is not set.

Change #2: On systems without killpg, oslib.c provides an
implementation.  However it is not declared in a place visible to
suspend.def.  Moving the declaration from jobs.c to externs.h makes it
visible in both files.

Fix externs.h declaration of gethostname
---
 externs.h | 6 +++++-
 jobs.c    | 4 ----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/externs.h b/externs.h
index d73b5a1a..47d36969 100644
--- a/externs.h
+++ b/externs.h
@@ -309,7 +309,7 @@ extern int getdtablesize (void);
 #endif /* !HAVE_GETDTABLESIZE */
 
 #if !defined (HAVE_GETHOSTNAME)
-extern int gethostname (char *, int);
+extern int gethostname (char *, size_t);
 #endif /* !HAVE_GETHOSTNAME */
 
 extern int getmaxgroups (void);
@@ -581,4 +581,8 @@ extern int match_pattern_wchar (wchar_t *, wchar_t *, int);
 extern int wmatchlen (wchar_t *, size_t);
 #endif
 
+#if !defined (HAVE_KILLPG)
+extern int killpg (pid_t, int);
+#endif
+
 #endif /* _EXTERNS_H_ */
diff --git a/jobs.c b/jobs.c
index 07f8ca7a..a3214656 100644
--- a/jobs.c
+++ b/jobs.c
@@ -84,10 +84,6 @@
 extern int errno;
 #endif /* !errno */
 
-#if !defined (HAVE_KILLPG)
-extern int killpg (pid_t, int);
-#endif
-
 #if !DEFAULT_CHILD_MAX
 #  define DEFAULT_CHILD_MAX 4096
 #endif
-- 
2.51.2


Reply via email to