view src/popt-1-win32.patch @ 4467:b7d6a53fa46c

gcc: update to 7.1 with tools * src/build-gcc.mk: update version 7.1.0 * src/cloog.mk: update 0.18.4 * src/gmp.mk: update 6.1.2 * src/isl.mk: update 0.16.1, add no-undefined flag * src/mpfr.mk: update 3.1.6 * src/native-gcc.mk: update 7.1.0 * src/isl-1-fixes.patch: removed file * dist-files.mk: remove reference to patch files, add mingw-w64 patch * src/build-gcc-1-mingw-float.patch: removed patch * src/native-gcc-1-mingw-float.patch: removed patch * src/build-gcc-2-intrinsics.patch: removed patch * src/native-gcc-2-intrinsics.patch: removed patch * src/mingw-w64.mk: update to 5.0.2 * src/gcc-1-mingw-float.patch: remove patch * src/gcc-2-darwin-no-pie.patch: remove patch * src/mingw-w64-2-pthreads.patch: new file * src/pthreads.mk: apply mingw patches to mingw sources before running configure
author John D
date Mon, 31 Jul 2017 16:53:21 -0400
parents 99516e73b368
children
line wrap: on
line source

This file is part of MXE.
See index.html for further information.

diff -urN a/popt.c b/popt.c
--- a/popt.c	2010-01-19 01:39:10.000000000 +0100
+++ b/popt.c	2010-05-12 00:15:14.959504505 +0200
@@ -972,6 +972,21 @@
 /*@=unqualifiedtrans =nullstate@*/
 }
 
+/* Win32 typically lacks random/srandom, but has rand/srand which
+ * produces frankly rubbish random numbers and has RAND_MAX = 0x7FFF.
+ */
+#ifndef HAVE_RANDOM
+static int
+random ()
+{
+  return rand () << 15 | rand ();
+}
+#endif
+
+#ifndef HAVE_SRANDOM
+#define srandom srand
+#endif
+
 /*@unchecked@*/
 static unsigned int seed = 0;
 
diff -urN a/poptconfig.c b/poptconfig.c
--- a/poptconfig.c	2009-05-20 15:18:07.000000000 +0200
+++ b/poptconfig.c	2010-05-12 00:15:14.959504505 +0200
@@ -141,18 +141,23 @@
 int poptSaneFile(const char * fn)
 {
     struct stat sb;
+#ifdef HAVE_GETUID
     uid_t uid = getuid();
-
+#endif
     if (stat(fn, &sb) == -1)
 	return 1;
+#ifdef HAVE_GETUID
     if ((uid_t)sb.st_uid != uid)
 	return 0;
+#endif
     if (!S_ISREG(sb.st_mode))
 	return 0;
+#ifdef HAVE_GETUID
 /*@-bitwisesigned@*/
     if (sb.st_mode & (S_IWGRP|S_IWOTH))
 	return 0;
 /*@=bitwisesigned@*/
+#endif
     return 1;
 }
 
diff -urN a/popthelp.c b/popthelp.c
--- a/popthelp.c	2009-08-28 02:06:33.000000000 +0200
+++ b/popthelp.c	2010-05-12 00:15:14.964949157 +0200
@@ -12,8 +12,10 @@
 
 #define        POPT_USE_TIOCGWINSZ
 #ifdef POPT_USE_TIOCGWINSZ
+#ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
+#endif
 
 #define	POPT_WCHAR_HACK
 #ifdef 	POPT_WCHAR_HACK