Created
October 14, 2016 09:39
-
-
Save panosdim/043bbeda9f003eb2d4716d82692582d1 to your computer and use it in GitHub Desktop.
solaris patch for fish compile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -Naur fish-2.3.1/build_tools/git_version_gen.sh fish-2.3.1-sol/build_tools/git_version_gen.sh | |
--- fish-2.3.1/build_tools/git_version_gen.sh 2016-07-03 14:15:45.000000000 +0000 | |
+++ fish-2.3.1-sol/build_tools/git_version_gen.sh 2016-10-14 10:44:21.387340000 +0000 | |
@@ -1,4 +1,4 @@ | |
-#!/bin/sh | |
+#!/usr/xpg4/bin/sh | |
# Originally from the git sources (GIT-VERSION-GEN) | |
# Presumably (C) Junio C Hamano <junkio@cox.net> | |
# Reused under GPL v2.0 | |
diff -Naur fish-2.3.1/src/env_universal_common.cpp fish-2.3.1-sol/src/env_universal_common.cpp | |
--- fish-2.3.1/src/env_universal_common.cpp 2016-07-03 14:15:45.000000000 +0000 | |
+++ fish-2.3.1-sol/src/env_universal_common.cpp 2016-10-13 09:22:44.000000000 +0000 | |
@@ -49,6 +49,50 @@ | |
#include <notify.h> | |
#endif | |
+/* Solaris additions */ | |
+#ifndef MAP_FILE | |
+#define MAP_FILE 0 | |
+#endif | |
+ | |
+// flock wrapper for solaris | |
+int flock(int fd, int op) { | |
+ int rc = 0; | |
+ | |
+#if defined(F_SETLK) && defined(F_SETLKW) | |
+ #define LOCK_SH 1 /* shared lock */ | |
+ #define LOCK_EX 2 /* exclusive lock */ | |
+ #define LOCK_NB 4 /* don't block when locking */ | |
+ #define LOCK_UN 8 /* unlock */ | |
+ struct flock fl = {0}; | |
+ | |
+ switch (op & (LOCK_EX|LOCK_SH|LOCK_UN)) { | |
+ case LOCK_EX: | |
+ fl.l_type = F_WRLCK; | |
+ break; | |
+ | |
+ case LOCK_SH: | |
+ fl.l_type = F_RDLCK; | |
+ break; | |
+ | |
+ case LOCK_UN: | |
+ fl.l_type = F_UNLCK; | |
+ break; | |
+ | |
+ default: | |
+ errno = EINVAL; | |
+ return -1; | |
+ } | |
+ | |
+ fl.l_whence = SEEK_SET; | |
+ rc = fcntl(fd, op & LOCK_NB ? F_SETLK : F_SETLKW, &fl); | |
+ | |
+ if (rc && (errno == EAGAIN)) | |
+ errno = EWOULDBLOCK; | |
+#endif | |
+ | |
+ return rc; | |
+} | |
+ | |
// NAME_MAX is not defined on Solaris and suggests the use of pathconf() | |
// There is no obvious sensible pathconf() for shared memory and _XPG_NAME_MAX | |
// seems a reasonable choice. | |
diff -Naur fish-2.3.1/src/highlight.cpp fish-2.3.1-sol/src/highlight.cpp | |
--- fish-2.3.1/src/highlight.cpp 2016-07-03 14:15:45.000000000 +0000 | |
+++ fish-2.3.1-sol/src/highlight.cpp 2016-10-13 08:35:27.000000000 +0000 | |
@@ -33,6 +33,16 @@ | |
#include "history.h" | |
#include "parse_tree.h" | |
+#if !defined(HAVE_DIRFD) | |
+# if defined(sun) | |
+# if !defined(__XOPEN_OR_POSIX) | |
+# define dirfd(d) (d->dd_fd) | |
+# else // !defined(__XOPEN_OR_POSIX) | |
+# define dirfd(d) (d->d_fd) | |
+# endif // !defined(__XOPEN_OR_POSIX) | |
+# endif // defined(sun) | |
+#endif // !defined(HAVE_DIRFD) | |
+ | |
#define CURSOR_POSITION_INVALID ((size_t)(-1)) | |
/** | |
diff -Naur fish-2.3.1/src/wutil.cpp fish-2.3.1-sol/src/wutil.cpp | |
--- fish-2.3.1/src/wutil.cpp 2016-07-03 14:15:45.000000000 +0000 | |
+++ fish-2.3.1-sol/src/wutil.cpp 2016-10-13 15:50:00.000000000 +0000 | |
@@ -149,7 +149,7 @@ | |
{ | |
wcstring retval; | |
- char *res = getcwd(NULL, 0); | |
+ char *res = getcwd(NULL, PATH_MAX); | |
if (res) | |
{ | |
retval = str2wcstring(res); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment