From f26bf1396557e4bc739d6a7703099f75bfe2fb99 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Mon, 25 Feb 2019 21:08:46 -0500 Subject: fix warning from -Wall --- src/fnmatch/fnmatch.c | 2 ++ src/glob/glob.c | 2 +- src/nonstd/__libc.c | 1 + src/nonstd/__libc_start.c | 1 - src/nonstd/__pthread_per_thread.c | 9 ++++++--- src/nonstd/_printf.h | 1 - src/stdio/popen.c | 3 +++ src/unistd/getegid.c | 2 +- src/unistd/geteuid.c | 2 +- src/unistd/getgid.c | 2 +- src/unistd/getopt.c | 2 +- src/unistd/getpgrp.c | 2 +- src/unistd/getpid.c | 2 +- src/unistd/getppid.c | 2 +- src/unistd/getuid.c | 2 +- 15 files changed, 21 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/fnmatch/fnmatch.c b/src/fnmatch/fnmatch.c index 4e566524..2f330951 100644 --- a/src/fnmatch/fnmatch.c +++ b/src/fnmatch/fnmatch.c @@ -6,8 +6,10 @@ int fnmatch(const char * pattern, const char * string, int flags) ASSERT_NONNULL(pattern); ASSERT_NONNULL(string); /* __ASSERT_FLAGS(flags, FNM_PATHNAME | FNM_NOESCAPE | FNM_PERIOD); */ + /* const char *ppos = pattern; const char *spos = string; + */ return 0; } diff --git a/src/glob/glob.c b/src/glob/glob.c index 3de2532e..e3b7525f 100644 --- a/src/glob/glob.c +++ b/src/glob/glob.c @@ -37,7 +37,7 @@ int glob(const char * restrict pattern, int flags, int (*errfunc) (const char * } char *path = malloc(strlen(pattern) + 1); - strcpt(path, pattern); + strcpy(path, pattern); for (i = 0; path[i]; i++) { if (path[i] == '/') { diff --git a/src/nonstd/__libc.c b/src/nonstd/__libc.c index 2d246203..e1d64c6d 100644 --- a/src/nonstd/__libc.c +++ b/src/nonstd/__libc.c @@ -1,3 +1,4 @@ +#include "sys/types.h" #include #include "locale.h" #include "nonstd/locale.h" diff --git a/src/nonstd/__libc_start.c b/src/nonstd/__libc_start.c index 8dab57fb..0cff0ab3 100644 --- a/src/nonstd/__libc_start.c +++ b/src/nonstd/__libc_start.c @@ -23,4 +23,3 @@ void __libc_start(int argc, char **argv) exit(main(argc, argv)); } - diff --git a/src/nonstd/__pthread_per_thread.c b/src/nonstd/__pthread_per_thread.c index 0dff3999..0f633a1b 100644 --- a/src/nonstd/__pthread_per_thread.c +++ b/src/nonstd/__pthread_per_thread.c @@ -1,10 +1,12 @@ +#if defined _POSIX_C_SOURCE && 199506L <= _POSIX_C_SOURCE + #include "pthread.h" static pthread_key_t __per_thread_key; static void __make_key(void) { - pthread_key_create(&key, NULL); + pthread_key_create(&__per_thread_key, NULL); } static struct per_thread *per_thread(void) @@ -12,12 +14,13 @@ static struct per_thread *per_thread(void) static pthread_once_t key_once = PTHREAD_ONCE_INIT; struct per_thread *pt; pthread_once(&key_once, __make_key); - if ((pt = pthread_getspecific(key)) == NULL) { + if ((pt = pthread_getspecific(__per_thread_key)) == NULL) { pt = calloc(1, sizeof (*pt)); - pthread_setspecific(key, pt); + pthread_setspecific(__per_thread_key, pt); } return pt; } +#endif /* LINK(pthread) diff --git a/src/nonstd/_printf.h b/src/nonstd/_printf.h index 0c513bef..fa132367 100644 --- a/src/nonstd/_printf.h +++ b/src/nonstd/_printf.h @@ -58,7 +58,6 @@ int (__printf)(struct io_options *opt, const char * format, va_list arg) { extern int isdigit(int); extern int isupper(int); - extern size_t fwrite(char *, size_t, size_t, struct __FILE *); char buf[BUFSIZ]; int nout = 0; diff --git a/src/stdio/popen.c b/src/stdio/popen.c index 56fce132..ab9b1663 100644 --- a/src/stdio/popen.c +++ b/src/stdio/popen.c @@ -54,7 +54,10 @@ FILE * popen(const char * command, const char * mode) return NULL; } + #if defined __STDC_VERSION__ fwide(p, -1); + #endif + p->pipe_pid = child; return p; } diff --git a/src/unistd/getegid.c b/src/unistd/getegid.c index 617e3b70..da8a372f 100644 --- a/src/unistd/getegid.c +++ b/src/unistd/getegid.c @@ -5,7 +5,7 @@ gid_t getegid(void) { - SCNOFAIL(); + SYSCALL("getegid", gid_t, -1, 0, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/geteuid.c b/src/unistd/geteuid.c index 6ff0d186..2bc4c054 100644 --- a/src/unistd/geteuid.c +++ b/src/unistd/geteuid.c @@ -5,7 +5,7 @@ uid_t geteuid(void) { - SCNOFAIL(); + SYSCALL("geteuid", uid_t, -1, 0, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/getgid.c b/src/unistd/getgid.c index 03c5f62b..0d4a070d 100644 --- a/src/unistd/getgid.c +++ b/src/unistd/getgid.c @@ -5,7 +5,7 @@ gid_t getgid(void) { - SCNOFAIL(); + SYSCALL("getgid", gid_t, -1, 0, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/getopt.c b/src/unistd/getopt.c index dc1803dd..a2dbea7b 100644 --- a/src/unistd/getopt.c +++ b/src/unistd/getopt.c @@ -8,7 +8,7 @@ int getopt(int argc, char * const argv[], const char *optstring) static int optchar = 0; char *cursor = NULL; - if (optind = 0 || argv[optind][optchar] == '\0') { + if (optind == 0 || argv[optind][optchar] == '\0') { optind++; optchar = 0; } diff --git a/src/unistd/getpgrp.c b/src/unistd/getpgrp.c index fd079ff1..897cd6be 100644 --- a/src/unistd/getpgrp.c +++ b/src/unistd/getpgrp.c @@ -5,7 +5,7 @@ pid_t getpgrp(void) { - SCNOFAIL(); + SYSCALL("getpgrp", pid_t, -1, 0, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/getpid.c b/src/unistd/getpid.c index 333735b2..eb6be595 100644 --- a/src/unistd/getpid.c +++ b/src/unistd/getpid.c @@ -5,7 +5,7 @@ pid_t getpid(void) { - SCNOFAIL(); + SYSCALL("getpid", pid_t, -1, 0, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/getppid.c b/src/unistd/getppid.c index d0518c3e..2fc880a2 100644 --- a/src/unistd/getppid.c +++ b/src/unistd/getppid.c @@ -5,7 +5,7 @@ pid_t getppid(void) { - SCNOFAIL(); + SYSCALL("getppid", pid_t, -1, 0, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/getuid.c b/src/unistd/getuid.c index 8a06b900..d85814d4 100644 --- a/src/unistd/getuid.c +++ b/src/unistd/getuid.c @@ -5,7 +5,7 @@ uid_t getuid(void) { - SCNOFAIL(); + SYSCALL("getuid", uid_t, -1, 0, 0, 0, 0, 0, 0); } /* POSIX(1) -- cgit v1.2.1