[PATCH 01/12] wipefs, sfdisk: include libgen.h for basename(3p)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>

Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
---
 disk-utils/sfdisk.c | 1 +
 misc-utils/wipefs.c | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
index 81371eb..14c7cc0 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 5948944..abcf5eb 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);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux