aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-05-08 19:01:55 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2013-07-01 08:56:04 +0300
commit450e9cb17d3d86e3e45fd427c85644ac64ec60a4 (patch)
tree39e0c67d2650164c9095ba90d47485b8170c571f
parent1075562c9e34153b43c12ec5c0b173a1a593b92a (diff)
use xstrdup in a few more places
These call sites either assume there is no failure (they deref the pointer right away), or the exit themselves. Use xstrdup() instead. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rw-r--r--jffs2reader.c2
-rw-r--r--mkfs.jffs2.c2
-rw-r--r--mkfs.ubifs/mkfs.ubifs.c4
-rw-r--r--nanddump.c5
4 files changed, 5 insertions, 8 deletions
diff --git a/jffs2reader.c b/jffs2reader.c
index 5231ff0..a62da9a 100644
--- a/jffs2reader.c
+++ b/jffs2reader.c
@@ -694,7 +694,7 @@ struct jffs2_raw_dirent *resolvepath0(char *o, size_t size, uint32_t ino,
return NULL;
}
- pp = path = strdup(p);
+ pp = path = xstrdup(p);
if (*path == '/') {
path++;
diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
index c1b0f0d..f09c0b2 100644
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
@@ -469,7 +469,7 @@ static int interpret_table_entry(struct filesystem_entry *root, char *line)
} else {
/* If parent is NULL (happens with device table entries),
* try and find our parent now) */
- tmp = strdup(name);
+ tmp = xstrdup(name);
dir = dirname(tmp);
parent = find_filesystem_entry(root, dir, S_IFDIR);
free(tmp);
diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
index 427e37d..f9977bc 100644
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
@@ -534,7 +534,7 @@ static int get_options(int argc, char**argv)
return err_msg("bad maximum LEB count");
break;
case 'o':
- output = strdup(optarg);
+ output = xstrdup(optarg);
break;
case 'D':
tbl_file = optarg;
@@ -627,7 +627,7 @@ static int get_options(int argc, char**argv)
}
if (optind != argc && !output)
- output = strdup(argv[optind]);
+ output = xstrdup(argv[optind]);
if (!output)
return err_msg("not output device or file specified");
diff --git a/nanddump.c b/nanddump.c
index 85ccd5d..4b3e14d 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -159,10 +159,7 @@ static void process_options(int argc, char * const argv[])
start_addr = simple_strtoll(optarg, &error);
break;
case 'f':
- if (!(dumpfile = strdup(optarg))) {
- perror("stddup");
- exit(EXIT_FAILURE);
- }
+ dumpfile = xstrdup(optarg);
break;
case 'l':
length = simple_strtoll(optarg, &error);