summaryrefslogtreecommitdiff
path: root/pkgtools/pbulk
diff options
context:
space:
mode:
authorjperkin <jperkin@pkgsrc.org>2013-01-14 14:33:28 +0000
committerjperkin <jperkin@pkgsrc.org>2013-01-14 14:33:28 +0000
commitd39201e64e1be312882973e3ef87872dd44837f5 (patch)
treed0b997c396c758d6934a141e8c579ad4d62ade5c /pkgtools/pbulk
parentc686b302cf916c791b5e7f8b31b57962ad10e82c (diff)
downloadpkgsrc-d39201e64e1be312882973e3ef87872dd44837f5.tar.gz
pbulk-base-0.47: Portability fixes
- Prefer fcntl FD_CLOEXEC to ioctl FIOCLEX. - Reset SIGPIPE action to default for the build child, avoids 'yes' spinning indefinitely on EPIPE in Solaris builds, notably for print/pdf2djvu.
Diffstat (limited to 'pkgtools/pbulk')
-rw-r--r--pkgtools/pbulk/files/pbulk/pbuild/master.c10
-rw-r--r--pkgtools/pbulk/files/pbulk/pbuild/pbuild.c12
-rw-r--r--pkgtools/pbulk/files/pbulk/pscan/master.c10
3 files changed, 17 insertions, 15 deletions
diff --git a/pkgtools/pbulk/files/pbulk/pbuild/master.c b/pkgtools/pbulk/files/pbulk/pbuild/master.c
index f602e2a98ae..a63445974e2 100644
--- a/pkgtools/pbulk/files/pbulk/pbuild/master.c
+++ b/pkgtools/pbulk/files/pbulk/pbuild/master.c
@@ -1,4 +1,4 @@
-/* $NetBSD: master.c,v 1.8 2009/01/31 23:25:38 joerg Exp $ */
+/* $NetBSD: master.c,v 1.9 2013/01/14 14:33:28 jperkin Exp $ */
/*-
* Copyright (c) 2007, 2009 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -35,14 +35,12 @@
#include <nbcompat/types.h>
#include <sys/ioctl.h>
-#ifdef __sun
-#include <sys/filio.h>
-#endif
#include <nbcompat/queue.h>
#include <sys/socket.h>
#include <nbcompat/time.h>
#include <sys/wait.h>
#include <nbcompat/err.h>
+#include <fcntl.h>
#include <signal.h>
#include <nbcompat/stdlib.h>
#include <nbcompat/stdio.h>
@@ -308,10 +306,8 @@ master_mode(const char *master_port, const char *start_script)
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd == -1)
err(1, "Could not create socket");
-#ifdef FIOCLEX
- if (ioctl(fd, FIOCLEX, NULL) == -1)
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
err(1, "Could not set close-on-exec flag");
-#endif
if (bind(fd, (struct sockaddr *)&dst, sizeof(dst)) == -1)
err(1, "Could not bind socket");
if (listen(fd, 5) == -1)
diff --git a/pkgtools/pbulk/files/pbulk/pbuild/pbuild.c b/pkgtools/pbulk/files/pbulk/pbuild/pbuild.c
index 6244d8ae7c1..979fae7ee34 100644
--- a/pkgtools/pbulk/files/pbulk/pbuild/pbuild.c
+++ b/pkgtools/pbulk/files/pbulk/pbuild/pbuild.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pbuild.c,v 1.5 2007/08/05 14:15:55 joerg Exp $ */
+/* $NetBSD: pbuild.c,v 1.6 2013/01/14 14:33:28 jperkin Exp $ */
/*-
* Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -174,6 +174,7 @@ main(int argc, char **argv)
int
build_package(const char *build_info, size_t len)
{
+ struct sigaction sa;
int input[2];
pid_t child;
@@ -210,6 +211,15 @@ build_package(const char *build_info, size_t len)
return ret;
}
+ /* Reset SIGPIPE handling for child */
+#if !defined(__INTERIX)
+ sa.sa_sigaction = NULL;
+#endif
+ sa.sa_handler = SIG_DFL;
+ sa.sa_flags = 0;
+ (void)sigemptyset(&sa.sa_mask);
+ (void)sigaction(SIGPIPE, (struct sigaction *)&sa, NULL);
+
(void)close(input[1]);
if (dup2(input[0], 0) == -1) {
const char err_msg[] = "dup failed for stdin\n";
diff --git a/pkgtools/pbulk/files/pbulk/pscan/master.c b/pkgtools/pbulk/files/pbulk/pscan/master.c
index 94221ee527c..598609cca84 100644
--- a/pkgtools/pbulk/files/pbulk/pscan/master.c
+++ b/pkgtools/pbulk/files/pbulk/pscan/master.c
@@ -1,4 +1,4 @@
-/* $NetBSD: master.c,v 1.7 2009/01/31 23:25:38 joerg Exp $ */
+/* $NetBSD: master.c,v 1.8 2013/01/14 14:33:28 jperkin Exp $ */
/*-
* Copyright (c) 2007, 2009 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -36,14 +36,12 @@
#include <nbcompat/types.h>
#include <nbcompat/queue.h>
#include <sys/ioctl.h>
-#ifdef __sun
-#include <sys/filio.h>
-#endif
#include <sys/socket.h>
#include <nbcompat/time.h>
#include <sys/wait.h>
#include <nbcompat/err.h>
#include <signal.h>
+#include <fcntl.h>
#include <nbcompat/stdlib.h>
#include <nbcompat/stdio.h>
#include <nbcompat/string.h>
@@ -259,10 +257,8 @@ master_mode(const char *master_port, const char *start_script)
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd == -1)
err(1, "Could not create socket");
-#ifdef FIOCLEX
- if (ioctl(fd, FIOCLEX, NULL) == -1)
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
err(1, "Could not set close-on-exec flag");
-#endif
if (bind(fd, (struct sockaddr *)&dst, sizeof(dst)) == -1)
err(1, "Could not bind socket");
if (listen(fd, 5) == -1)