This fixes a segfault in mount (and possibly elsewhere) when invoked without a -t parameter. Broken in 7ef9fd7 when the common xalloc.h libs were introduced. Signed-off-by: Dave Reisner <dreisner@xxxxxxxxxxxxx> --- include/xalloc.h | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/xalloc.h b/include/xalloc.h index 8c505be..bea7e31 100644 --- a/include/xalloc.h +++ b/include/xalloc.h @@ -51,9 +51,14 @@ void *xcalloc(const size_t nelems, const size_t size) static inline char *xstrdup(const char *str) { - char *ret = strdup(str); + char *ret; - if (!ret && str) + if (!str) + return NULL; + + ret = strdup(str); + + if (!ret) err(XALLOC_EXIT_CODE, "cannot duplicate string"); return ret; } -- 1.7.6.4 -- 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