closefrom() function return void, not int:
https://man.freebsd.org/cgi/man.cgi?closefrom(2)
https://docs.oracle.com/cd/E88353_01/html/E37843/closefrom-3c.html

Apparently the postfix-provided wrapper was supposed to
be void too, at least this is how it's documented.  But
the actual implementation return int.  Change the return
type to match documented behavour.

Found while trying to build postfix on Hurd: it provides
closefrom(), and the system prototype does not match the
postfix prototype.

Introduced in 2.2.0.

Signed-off-by: Michael Tokarev <m...@tls.msk.ru>

diff --git a/src/util/sys_compat.c b/src/util/sys_compat.c
index 8bf8e581..75aaba84 100644
--- a/src/util/sys_compat.c
+++ b/src/util/sys_compat.c
@@ -286,7 +286,7 @@ int     dup2_pass_on_exec(int oldd, int newd)
 
 /* closefrom() - closes all file descriptors from the given one up */
 
-int     closefrom(int lowfd)
+void    closefrom(int lowfd)
 {
     int     fd_limit = open_limit(0);
     int     fd;
@@ -304,8 +304,6 @@ int     closefrom(int lowfd)
        fd_limit = 500;
     for (fd = lowfd; fd < fd_limit; fd++)
        (void) close(fd);
-
-    return (0);
 }
 
 #endif
diff --git a/src/util/sys_defs.h b/src/util/sys_defs.h
index 62749ab5..a57f545d 100644
--- a/src/util/sys_defs.h
+++ b/src/util/sys_defs.h
@@ -1526,7 +1526,7 @@ extern int setsid(void);
 #endif
 
 #ifndef HAS_CLOSEFROM
-extern int closefrom(int);
+extern void closefrom(int);
 
 #endif
 
_______________________________________________
Postfix-devel mailing list -- postfix-devel@postfix.org
To unsubscribe send an email to postfix-devel-le...@postfix.org

Reply via email to