summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuediger Meier2016-02-18 03:07:23 +0100
committerRuediger Meier2016-03-07 21:25:36 +0100
commit8acff75afc900972a071eae7a3e5e5a1704e099d (patch)
tree9f222e8fd298bb1b338557f5bbff1ee84ded4f96
parentMerge branch 'master' of https://github.com/Rufflewind/util-linux (diff)
downloadkernel-qcow2-util-linux-8acff75afc900972a071eae7a3e5e5a1704e099d.tar.gz
kernel-qcow2-util-linux-8acff75afc900972a071eae7a3e5e5a1704e099d.tar.xz
kernel-qcow2-util-linux-8acff75afc900972a071eae7a3e5e5a1704e099d.zip
wipefs, sfdisk: include libgen.h for basename(3p)
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
-rw-r--r--disk-utils/sfdisk.c1
-rw-r--r--misc-utils/wipefs.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
index 81371eb34..14c7cc089 100644
--- a/disk-utils/sfdisk.c
+++ b/disk-utils/sfdisk.c
@@ -35,6 +35,7 @@
#ifdef HAVE_LIBREADLINE
# include <readline/readline.h>
#endif
+#include <libgen.h>
#include "c.h"
#include "xalloc.h"
diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c
index 594894447..abcf5ebe3 100644
--- a/misc-utils/wipefs.c
+++ b/misc-utils/wipefs.c
@@ -29,6 +29,7 @@
#include <getopt.h>
#include <string.h>
#include <limits.h>
+#include <libgen.h>
#include <blkid.h>
@@ -378,9 +379,12 @@ do_wipe(struct wipe_desc *wp, const char *devname, int flags)
if (zap && (flags & WP_FL_BACKUP)) {
const char *home = getenv ("HOME");
+ char *tmp = xstrdup(devname);
+
if (!home)
errx(EXIT_FAILURE, _("failed to create a signature backup, $HOME undefined"));
- xasprintf (&backup, "%s/wipefs-%s-", home, basename(devname));
+ xasprintf (&backup, "%s/wipefs-%s-", home, basename(tmp));
+ free(tmp);
}
wp0 = clone_offset(wp);