.. rather that causing a less-obvious violation of segments.
Signed-off-by: NeilBrown <neilb@suse.de>
if (c) c++; else c= info.name;
if (isdigit(*c) && ((ident->autof & 7)==4 || (ident->autof&7)==6))
/* /dev/md/d0 style for partitionable */
- asprintf(&mddev, "/dev/md/d%s", c);
+ xasprintf(&mddev, "/dev/md/d%s", c);
else
- asprintf(&mddev, "/dev/md/%s", c);
+ xasprintf(&mddev, "/dev/md/%s", c);
mdfd = open_mddev(mddev, ident->autof);
if (mdfd < 0) {
st->ss->free_super(st);
alert_mail_from = strdup(w);
else {
char *t= NULL;
- asprintf(&t, "%s %s", alert_mail_from, w);
+ xasprintf(&t, "%s %s", alert_mail_from, w);
free(alert_mail_from);
alert_mail_from = t;
}
extern int open_mddev_devnum(char *devname, int devnum, char *name,
char *chosen_name, int parts);
+#include <assert.h>
+#include <stdarg.h>
+static inline int xasprintf(char **strp, const char *fmt, ...) {
+ va_list ap;
+ int ret;
+ va_start(ap, fmt);
+ ret = asprintf(strp, fmt, ap);
+ va_end(ap);
+ assert(ret >= 0);
+ return ret;
+}
#define LEVEL_MULTIPATH (-4)
#define LEVEL_LINEAR (-1)