diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/carefulputc.h | 4 | ||||
-rw-r--r-- | include/closestream.h | 7 | ||||
-rw-r--r-- | include/pathnames.h | 4 | ||||
-rw-r--r-- | include/xalloc.h | 6 |
4 files changed, 11 insertions, 10 deletions
diff --git a/include/carefulputc.h b/include/carefulputc.h index 54a02bfef..f1c03566d 100644 --- a/include/carefulputc.h +++ b/include/carefulputc.h @@ -10,13 +10,15 @@ #include <string.h> #include <ctype.h> +#include "cctype.h" + static inline int fputc_careful(int c, FILE *fp, const char fail) { int ret; if (isprint(c) || c == '\a' || c == '\t' || c == '\r' || c == '\n') ret = putc(c, fp); - else if (!isascii(c)) + else if (!c_isascii(c)) ret = fprintf(fp, "\\%3o", (unsigned char)c); else { ret = putc(fail, fp); diff --git a/include/closestream.h b/include/closestream.h index 6a62e48e8..83df1ee7d 100644 --- a/include/closestream.h +++ b/include/closestream.h @@ -39,7 +39,7 @@ close_stream(FILE * stream) static inline void close_stdout(void) { - if (close_stream(stdout) != 0 && !(errno == EPIPE)) { + if (stdout && close_stream(stdout) != 0 && !(errno == EPIPE)) { if (errno) warn(_("write error")); else @@ -47,8 +47,11 @@ close_stdout(void) _exit(CLOSE_EXIT_CODE); } - if (close_stream(stderr) != 0) + if (stderr && close_stream(stderr) != 0) _exit(CLOSE_EXIT_CODE); + + stdout = NULL; + stderr = NULL; } static inline void diff --git a/include/pathnames.h b/include/pathnames.h index ee470ee4b..2e1f19355 100644 --- a/include/pathnames.h +++ b/include/pathnames.h @@ -104,6 +104,7 @@ #define _PATH_SYS_BLOCK "/sys/block" #define _PATH_SYS_DEVBLOCK "/sys/dev/block" +#define _PATH_SYS_DEVCHAR "/sys/dev/char" #define _PATH_SYS_CLASS "/sys/class" #define _PATH_SYS_SCSI "/sys/bus/scsi" @@ -167,9 +168,6 @@ /* deprecated */ #define _PATH_RAWDEVCTL_OLD "/dev/rawctl" -/* wdctl path */ -#define _PATH_WATCHDOG_DEV "/dev/watchdog" - /* ipc paths */ #define _PATH_PROC_SYSV_MSG "/proc/sysvipc/msg" #define _PATH_PROC_SYSV_SEM "/proc/sysvipc/sem" diff --git a/include/xalloc.h b/include/xalloc.h index 0129a85e2..48712a452 100644 --- a/include/xalloc.h +++ b/include/xalloc.h @@ -62,8 +62,7 @@ static inline char __attribute__((warn_unused_result)) __ul_returns_nonnull { char *ret; - if (!str) - return NULL; + assert(str); ret = strdup(str); @@ -77,8 +76,7 @@ xstrndup(const char *str, size_t size) { char *ret; - if (!str) - return NULL; + assert(str); ret = strndup(str, size); |