summaryrefslogtreecommitdiff
path: root/x11/xautolock/patches/patch-aa
blob: caef73f436497c31e0522cf005567bb33a44e5fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
$NetBSD: patch-aa,v 1.4 2003/08/09 08:32:15 tron Exp $

--- xautolock.c.orig	1999-03-11 23:43:25.000000000 +0100
+++ xautolock.c	2003-08-09 10:29:28.000000000 +0200
@@ -297,6 +297,8 @@
  *  with vroot.h, because it needs to know the real root window.
  */
 
+#include <sys/param.h>
+
 #if defined(hpux) || defined (__hpux)
 #ifndef _HPUX_SOURCE
 #define _HPUX_SOURCE
@@ -368,7 +370,11 @@
 #endif /* !NOSTDHDRS */
 
 #if !defined (apollo) && !defined (VMS)
+#if !defined (BSD) 
 #include <malloc.h>
+#endif /* !BSD */
+
+#include <fcntl.h>
 #include <unistd.h>
 #endif /* !apollo && !VMS */
 
@@ -2028,7 +2034,9 @@
 #else /* VMS */
   if (locker_pid)
   {
-#if !defined (UTEKV) && !defined (SYSV) && !defined(SVR4)
+#if defined (BSD)
+    int status;
+#elif !defined (UTEKV) && !defined (SYSV) && !defined(SVR4)
     union wait  status;      /* childs process status */
 #else /* !UTEKV && !SYSV && !SVR4 */
     int         status = 0;  /* childs process status */
@@ -2762,8 +2770,23 @@
 
   CheckConnectionAndSendMessage (d);
 
+#if !defined (apollo) && !defined (VMS)
+  if (close_out || close_err)
+  {
+    Int devnull;
+
+    devnull = open("/dev/null", O_WRONLY, 0);
+    if (devnull >= 0)
+    {
+      if (close_out) (Void) dup2(devnull, fileno(stdout));
+      if (close_err) (Void) dup2(devnull, fileno(stderr));
+      (Void) close(devnull);
+    }
+  }
+#else
   if (close_out) (Void) fclose (stdout);
   if (close_err) (Void) fclose (stderr);
+#endif
 
   (Void) XSetErrorHandler ((XErrorHandler) CatchFalseAlarm);