diff options
Diffstat (limited to 'src/libstddjb')
-rw-r--r-- | src/libstddjb/case_diffb.c | 15 | ||||
-rw-r--r-- | src/libstddjb/case_diffs.c | 6 | ||||
-rw-r--r-- | src/libstddjb/child_spawn.c | 3 | ||||
-rw-r--r-- | src/libstddjb/child_spawn0.c | 5 | ||||
-rw-r--r-- | src/libstddjb/child_spawn1_internal.c | 3 | ||||
-rw-r--r-- | src/libstddjb/sig_number.c | 2 |
6 files changed, 27 insertions, 7 deletions
diff --git a/src/libstddjb/case_diffb.c b/src/libstddjb/case_diffb.c index 1931c0f..f267756 100644 --- a/src/libstddjb/case_diffb.c +++ b/src/libstddjb/case_diffb.c @@ -1,7 +1,11 @@ /* ISC license. */ +#include <skalibs/config.h> #include <skalibs/bytestr.h> +#ifdef SKALIBS_FLAG_REPLACE_LIBC + + int case_diffb (char const *s, unsigned int len, char const *t) { register unsigned char x = 0, y = 0 ; @@ -16,3 +20,14 @@ int case_diffb (char const *s, unsigned int len, char const *t) } return (int)(x - y) ; } + +else + +#include <strings.h> + +int case_diffb (char const *s, unsigned int len, char const *t) +{ + return strncasecmp(s, t, len) ; +} + +#endif diff --git a/src/libstddjb/case_diffs.c b/src/libstddjb/case_diffs.c index 2731408..bf72472 100644 --- a/src/libstddjb/case_diffs.c +++ b/src/libstddjb/case_diffs.c @@ -1,7 +1,11 @@ /* ISC license. */ +#include <skalibs/config.h> #include <skalibs/bytestr.h> +#ifdef SKALIBS_FLAG_REPLACE_LIBC + + int case_diffs (char const *s, char const *t) { register unsigned char x = 1, y = 1 ; @@ -16,3 +20,5 @@ int case_diffs (char const *s, char const *t) } return (int)(x - y) ; } + +#endif diff --git a/src/libstddjb/child_spawn.c b/src/libstddjb/child_spawn.c index 922c777..18cee96 100644 --- a/src/libstddjb/child_spawn.c +++ b/src/libstddjb/child_spawn.c @@ -75,8 +75,7 @@ pid_t child_spawn (char const *prog, char const *const *argv, char const *const sigemptyset(&set) ; e = posix_spawnattr_setsigmask(&attr, &set) ; if (e) goto errattr ; - sigfillset(&set) ; - e = posix_spawnattr_setsigdefault(&attr, &set) ; + e = posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGMASK) ; if (e) goto errattr ; } e = posix_spawn_file_actions_init(&actions) ; diff --git a/src/libstddjb/child_spawn0.c b/src/libstddjb/child_spawn0.c index 7129515..bb8b29e 100644 --- a/src/libstddjb/child_spawn0.c +++ b/src/libstddjb/child_spawn0.c @@ -25,8 +25,7 @@ pid_t child_spawn0 (char const *prog, char const *const *argv, char const *const sigemptyset(&set) ; e = posix_spawnattr_setsigmask(&attr, &set) ; if (e) goto errattr ; - sigfillset(&set) ; - e = posix_spawnattr_setsigdefault(&attr, &set) ; + e = posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGMASK) ; if (e) goto errattr ; } if (!haspath && (setenv("PATH", SKALIBS_DEFAULTPATH, 0) < 0)) { e = errno ; goto errattr ; } @@ -47,6 +46,7 @@ pid_t child_spawn0 (char const *prog, char const *const *argv, char const *const #include <unistd.h> #include <skalibs/allreadwrite.h> +#include <skalibs/sig.h> #include <skalibs/djbunix.h> pid_t child_spawn0 (char const *prog, char const *const *argv, char const *const *envp) @@ -67,6 +67,7 @@ pid_t child_spawn0 (char const *prog, char const *const *argv, char const *const if (pid) { fd_close(p[0]) ; + sig_blocknone() ; pathexec_run(prog, argv, envp) ; e = errno ; fd_write(p[1], (char *)&e, sizeof(e)) ; diff --git a/src/libstddjb/child_spawn1_internal.c b/src/libstddjb/child_spawn1_internal.c index 8347f69..f833a15 100644 --- a/src/libstddjb/child_spawn1_internal.c +++ b/src/libstddjb/child_spawn1_internal.c @@ -29,8 +29,7 @@ pid_t child_spawn1_internal (char const *prog, char const *const *argv, char con sigemptyset(&set) ; e = posix_spawnattr_setsigmask(&attr, &set) ; if (e) goto errattr ; - sigfillset(&set) ; - e = posix_spawnattr_setsigdefault(&attr, &set) ; + e = posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGMASK) ; if (e) goto errattr ; } e = posix_spawn_file_actions_init(&actions) ; diff --git a/src/libstddjb/sig_number.c b/src/libstddjb/sig_number.c index 93d9b59..cbd897d 100644 --- a/src/libstddjb/sig_number.c +++ b/src/libstddjb/sig_number.c @@ -7,6 +7,6 @@ int sig_number (char const *name) { register sigtable_t const *p = skalibs_sigtable ; - for (; p->name ; p++) if (!str_diff(name, p->name)) break ; + for (; p->name ; p++) if (!case_diffs(name, p->name)) break ; return p->number ; } |