[beast/win32: 25/44] Work around the issue that suid wrappers are neither desired nor functional under windows.



commit 74dd92e70f3b0a28f992fd62a1296f215207543e
Author: Stefan Westerfeld <stefan space twc de>
Date:   Fri Sep 4 19:10:32 2009 +0200

    Work around the issue that suid wrappers are neither desired nor functional
    under windows.
    
    Based on 009_inline_lib_make.diff.

 launchers/suidmain.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/launchers/suidmain.c b/launchers/suidmain.c
index 192f50a..11d16c1 100644
--- a/launchers/suidmain.c
+++ b/launchers/suidmain.c
@@ -18,12 +18,13 @@
 #include "topconfig.h"  /* holds HAVE_SETEUID etc... */
 #include "suidmain.h"
 #include <sys/time.h>
-#include <sys/resource.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
+#ifndef WIN32
+#include <sys/resource.h>
 
 static int original_priority = 0;
 
@@ -137,3 +138,22 @@ main (int    argc,
   perror (executable);
   return -1;
 }
+#else
+int
+main (int    argc,
+      char **argv)
+{
+  /* find executable */
+  const char *executable = custom_find_executable (&argc, &argv);
+  char *xbuffer = malloc (strlen (executable) + 4);
+  sprintf (xbuffer, "%s.exe", executable);
+  executable = xbuffer;
+  
+  /* exec */
+  argv[0] = executable;
+  execv (executable, argv);
+  /* handle execution errors */
+  perror (executable);
+  return -1;
+}
+#endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]