summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/xalloc.h9
-rw-r--r--misc-utils/wipefs.c9
2 files changed, 9 insertions, 9 deletions
diff --git a/include/xalloc.h b/include/xalloc.h
index 2a8c78bc0..ff5432e59 100644
--- a/include/xalloc.h
+++ b/include/xalloc.h
@@ -43,4 +43,13 @@ void *xcalloc(const size_t nelems, const size_t size)
return ret;
}
+static inline char *xstrdup(const char *str)
+{
+ char *ret = strdup(str);
+
+ if (!ret && str)
+ err(EXIT_FAILURE, "cannot duplicate string");
+ return ret;
+}
+
#endif
diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c
index 2f223f0c2..d3033446f 100644
--- a/misc-utils/wipefs.c
+++ b/misc-utils/wipefs.c
@@ -136,15 +136,6 @@ add_offset(struct wipe_desc *wp0, loff_t offset, int zap)
return wp;
}
-static inline char *
-xstrdup(const char *s)
-{
- char *x = strdup(s);
- if (!x)
- err(EXIT_FAILURE, _("strdup failed"));
- return x;
-}
-
static struct wipe_desc *
get_offset_from_probe(struct wipe_desc *wp, blkid_probe pr, int zap)
{