mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-11-04 19:56:36 +08:00
50 lines
1.2 KiB
Diff
50 lines
1.2 KiB
Diff
Only in source: grep.patch
|
|
diff -ru source/lib/getprogname.c source-new/lib/getprogname.c
|
|
--- source/lib/getprogname.c 2017-01-16 09:29:13.000000000 -0800
|
|
+++ source-new/lib/getprogname.c 2017-07-23 20:49:21.133618122 -0700
|
|
@@ -43,13 +43,11 @@
|
|
# include <string.h>
|
|
#endif
|
|
|
|
-#ifdef __sgi
|
|
# include <string.h>
|
|
# include <unistd.h>
|
|
# include <stdio.h>
|
|
# include <fcntl.h>
|
|
-# include <sys/procfs.h>
|
|
-#endif
|
|
+# include <limits.h>
|
|
|
|
#include "dirname.h"
|
|
|
|
@@ -178,7 +176,16 @@
|
|
}
|
|
return NULL;
|
|
# else
|
|
-# error "getprogname module not ported to this OS"
|
|
+ char filename[PATH_MAX];
|
|
+ int fd = open ("sys:exe", O_RDONLY);
|
|
+ if (fd > 0) {
|
|
+ int len = read(fd, filename, PATH_MAX-1);
|
|
+ if (len > 0) {
|
|
+ filename[len] = '\0';
|
|
+ return strdup(filename);
|
|
+ }
|
|
+ }
|
|
+ return NULL;
|
|
# endif
|
|
}
|
|
|
|
diff -ru source/src/grep.c source-new/src/grep.c
|
|
--- source/src/grep.c 2017-07-02 10:41:41.000000000 -0700
|
|
+++ source-new/src/grep.c 2017-07-23 20:53:10.439131874 -0700
|
|
@@ -2895,7 +2895,7 @@
|
|
#ifdef _SC_PAGESIZE
|
|
long psize = sysconf (_SC_PAGESIZE);
|
|
#else
|
|
- long psize = getpagesize ();
|
|
+ long psize = 4096;
|
|
#endif
|
|
if (! (0 < psize && psize <= (SIZE_MAX - sizeof (uword)) / 2))
|
|
abort ();
|