[PATCH 3/3] mkfs.jffs2: use new xasprintf() helper

Mike Frysinger vapier at gentoo.org
Wed Sep 29 19:30:24 EDT 2010


Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 mkfs.jffs2.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
index 1ea3598..528a7fe 100644
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
@@ -391,14 +391,14 @@ static struct filesystem_entry *recursive_add_host_directory(
 			continue;
 		}
 
-		asprintf(&hpath, "%s/%s", hostpath, dp->d_name);
+		xasprintf(&hpath, "%s/%s", hostpath, dp->d_name);
 		if (lstat(hpath, &sb)) {
 			perror_msg_and_die("%s", hpath);
 		}
 		if (strcmp(targetpath, "/") == 0) {
-			asprintf(&tpath, "%s%s", targetpath, dp->d_name);
+			xasprintf(&tpath, "%s%s", targetpath, dp->d_name);
 		} else {
-			asprintf(&tpath, "%s/%s", targetpath, dp->d_name);
+			xasprintf(&tpath, "%s/%s", targetpath, dp->d_name);
 		}
 
 		switch (sb.st_mode & S_IFMT) {
@@ -489,7 +489,7 @@ static int interpret_table_entry(struct filesystem_entry *root, char *line)
 		error_msg_and_die("Device table entries require absolute paths");
 	}
 
-	asprintf(&hostpath, "%s%s", rootdir, name);
+	xasprintf(&hostpath, "%s%s", rootdir, name);
 
 	/* Check if this file already exists... */
 	switch (type) {
@@ -556,8 +556,8 @@ static int interpret_table_entry(struct filesystem_entry *root, char *line)
 					char *dname, *hpath;
 
 					for (i = start; i < count; i++) {
-						asprintf(&dname, "%s%lu", name, i);
-						asprintf(&hpath, "%s/%s%lu", rootdir, name, i);
+						xasprintf(&dname, "%s%lu", name, i);
+						xasprintf(&hpath, "%s/%s%lu", rootdir, name, i);
 						rdev = makedev(major, minor + (i * increment - start));
 						add_host_filesystem_entry(dname, hpath, uid, gid,
 								mode, rdev, parent);
-- 
1.7.2.3




More information about the linux-mtd mailing list