Merge pull request #2304 from jacquesg/solaris Solaris!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b5bd669..884c9bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -172,7 +172,7 @@ IF (ENABLE_TRACE STREQUAL "ON")
ENDIF()
# Include POSIX regex when it is required
-IF(WIN32 OR AMIGA OR ANDROID)
+IF(WIN32 OR AMIGA OR ANDROID OR CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
INCLUDE_DIRECTORIES(deps/regex)
SET(SRC_REGEX deps/regex/regex.c)
ENDIF()
@@ -290,6 +290,10 @@ IF (MSVC)
ELSE ()
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -Wall -Wextra ${CMAKE_C_FLAGS}")
+ IF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
+ SET(CMAKE_C_FLAGS "-std=c99 -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS ${CMAKE_C_FLAGS}")
+ ENDIF()
+
IF (WIN32 AND NOT CYGWIN)
SET(CMAKE_C_FLAGS_DEBUG "-D_DEBUG")
ENDIF ()
diff --git a/src/common.h b/src/common.h
index 9c8bdc1..dd97a30 100644
--- a/src/common.h
+++ b/src/common.h
@@ -44,6 +44,7 @@
#else
# include <unistd.h>
+# include <strings.h>
# ifdef GIT_THREADS
# include <pthread.h>
# include <sched.h>
diff --git a/src/config.c b/src/config.c
index b3168f7..16854c0 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1144,7 +1144,7 @@ int git_config_parse_int64(int64_t *out, const char *value)
}
fail_parse:
- giterr_set(GITERR_CONFIG, "Failed to parse '%s' as an integer", value);
+ giterr_set(GITERR_CONFIG, "Failed to parse '%s' as an integer", value ? value : "(null)");
return -1;
}
@@ -1164,7 +1164,7 @@ int git_config_parse_int32(int32_t *out, const char *value)
return 0;
fail_parse:
- giterr_set(GITERR_CONFIG, "Failed to parse '%s' as a 32-bit integer", value);
+ giterr_set(GITERR_CONFIG, "Failed to parse '%s' as a 32-bit integer", value ? value : "(null)");
return -1;
}
diff --git a/src/remote.c b/src/remote.c
index ea638e3..be7198a 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -73,7 +73,7 @@ static int ensure_remote_name_is_valid(const char *name)
if (!git_remote_is_valid_name(name)) {
giterr_set(
GITERR_CONFIG,
- "'%s' is not a valid remote name.", name);
+ "'%s' is not a valid remote name.", name ? name : "(null)");
error = GIT_EINVALIDSPEC;
}