diff options
author | Daniel LEVAI <leva@ecentrum.hu> | 2012-11-19 14:26:37 -0600 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2012-11-19 16:52:08 -0600 |
commit | f5e7485b6c8bfe3ea57ba4f5334fb963353e91d7 (patch) | |
tree | fde24af9290c0c090ef2af186340b63ba4161985 /system/ksh-openbsd/patches/linux/history_c.diff | |
parent | fb80020f10a2063b7273ffe8e4d18a1caed70028 (diff) | |
download | slackbuilds-f5e7485b6c8bfe3ea57ba4f5334fb963353e91d7.tar.gz |
system/ksh-openbsd: Added (OpenBSD's pdksh ported to Linux)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'system/ksh-openbsd/patches/linux/history_c.diff')
-rw-r--r-- | system/ksh-openbsd/patches/linux/history_c.diff | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/system/ksh-openbsd/patches/linux/history_c.diff b/system/ksh-openbsd/patches/linux/history_c.diff new file mode 100644 index 0000000000..04731805a9 --- /dev/null +++ b/system/ksh-openbsd/patches/linux/history_c.diff @@ -0,0 +1,46 @@ +--- ksh-openbsd_cvs/history.c 2010-02-23 12:49:16.000000000 +0100 ++++ ksh-openbsd_cvs.new/history.c 2010-04-01 21:01:24.133232595 +0200 +@@ -17,6 +17,7 @@ + + #include "sh.h" + #include <sys/stat.h> ++#include "strlcat.h" + + #ifdef HISTORY + # include <sys/file.h> +Linux specific modifications: + - #include stdint.h for uint32_t + - #define timespeccmp() which is sys/time.h in OpenBSD + - Linux doesn't have any LOCK flags for open(2), so use flock(2) instead + +--- ksh-openbsd_cvs/history.c 2011-09-01 08:09:51.486181269 +0200 ++++ ksh-openbsd_cvs.new/history.c 2011-09-01 08:08:59.657181265 +0200 +@@ -17,11 +17,17 @@ + #include "sh.h" + #include <sys/stat.h> + #include "strlcat.h" ++#include "stdint.h" + + #ifdef HISTORY + # include <sys/file.h> + # include <sys/mman.h> + ++#define timespeccmp(tsp, usp, cmp) \ ++ (((tsp)->tv_sec == (usp)->tv_sec) ? \ ++ ((tsp)->tv_nsec cmp (usp)->tv_nsec) : \ ++ ((tsp)->tv_sec cmp (usp)->tv_sec)) ++ + static void writehistfile(FILE *); + static FILE *history_open(int *); + static int history_load(FILE *, Source *); +@@ -604,7 +610,9 @@ + FILE *f = NULL; + struct stat sb; + +- if ((fd = open(hname, O_RDWR | O_CREAT | O_EXLOCK, 0600)) == -1) ++ if ((fd = open(hname, O_RDWR | O_CREAT, 0600)) == -1) ++ return (NULL); ++ if (flock(fd, LOCK_EX) == -1) + return (NULL); + f = fdopen(fd, "r+"); + if (f == NULL) { |