From b82237dfb2e7a652b01edbf4290e8d632359a666 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 13 Jan 2020 10:45:35 +0100 Subject: [PATCH] lib: add _PATH_TMP fallback - cleanup header of the file - fix fileutils.c warnings - add _PATH_TMP fallback Addresses: https://github.com/karelzak/util-linux/issues/931 Signed-off-by: Karel Zak --- include/pathnames.h | 9 ++++++--- lib/strutils.c | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/pathnames.h b/include/pathnames.h index ae09803698..97815e5f35 100644 --- a/include/pathnames.h +++ b/include/pathnames.h @@ -1,7 +1,6 @@ /* - * Vaguely based on - * @(#)pathnames.h 5.3 (Berkeley) 5/9/89 - * This code is in the public domain. + * No copyright is claimed. This code is in the public domain; do with + * it what you wish. */ #ifndef PATHNAMES_H #define PATHNAMES_H @@ -64,6 +63,10 @@ #define _PATH_SHADOW_PASSWD "/etc/shadow" #define _PATH_SHELLS "/etc/shells" +#ifndef _PATH_TMP +# define _PATH_TMP "/tmp/" +#endif + #ifndef _PATH_BTMP # define _PATH_BTMP "/var/log/btmp" #endif diff --git a/lib/strutils.c b/lib/strutils.c index 6e013f3a1a..84d2a1d7b1 100644 --- a/lib/strutils.c +++ b/lib/strutils.c @@ -18,6 +18,7 @@ #include "nls.h" #include "strutils.h" #include "bitops.h" +#include "pathnames.h" static int STRTOXX_EXIT_CODE = EXIT_FAILURE; @@ -1013,6 +1014,7 @@ int skip_fline(FILE *fp) } #ifdef TEST_PROGRAM_STRUTILS +#include static int test_strutils_sizes(int argc, char *argv[]) { -- 2.39.2