summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorManuel Bentele2019-08-21 14:58:42 +0200
committerManuel Bentele2019-08-21 14:58:42 +0200
commit0692b963aa3cb846d8abab5ef5247c4dbb3fec96 (patch)
treef13776d25da3e1adc1445aef22e7566ac98cbe84 /include
parentlosetup: added file format option to the man page (diff)
parentpartx: document -d vs. --nr and fix test (diff)
downloadkernel-qcow2-util-linux-kernel-qcow2.tar.gz
kernel-qcow2-util-linux-kernel-qcow2.tar.xz
kernel-qcow2-util-linux-kernel-qcow2.zip
lib/losetup: merge remote-tracking branch 'util-linux/master'kernel-qcow2
Signed-off-by: Manuel Bentele <development@manuel-bentele.de>
Diffstat (limited to 'include')
-rw-r--r--include/carefulputc.h4
-rw-r--r--include/closestream.h7
-rw-r--r--include/pathnames.h4
-rw-r--r--include/xalloc.h6
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);