summaryrefslogtreecommitdiff
path: root/x11/xautolock/patches/patch-aa
blob: f8b29537e708aa5592d56b1e95ba1706c437de7f (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
61
62
63
64
65
66
67
68
$NetBSD: patch-aa,v 1.5 2005/12/04 01:17:43 joerg Exp $

--- xautolock.c.orig	1999-03-11 22:43:25.000000000 +0000
+++ xautolock.c
@@ -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 */
 
@@ -1969,6 +1975,7 @@ Display*  d;  /* display pointer */
 
 #ifdef __GNUC__
 	default: /* Makes gcc -Wall shut up. */
+	  break;
 #endif /* __GNUC__ */
       }
     }
@@ -2028,7 +2035,9 @@ Display*  d;  /* display pointer */
 #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 +2771,23 @@ String  argv[];  /* array of arguments  
 
   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);