static int count_slaves(dev_t disk);
-static char *string_copy(const char *s)
-{
- char *ret;
-
- if (!s)
- return 0;
- ret = xmalloc(strlen(s)+1);
- strcpy(ret, s);
- return ret;
-}
-
static int string_to_int(const char *s)
{
long l;
data->eval_device = 1;
data->device = mnt_resolve_spec(spec, mnt_table_get_cache(fstab));
if (!data->device)
- data->device = string_copy(spec);
+ data->device = xstrdup(spec);
}
return data->device;
char *s;
const char *tpl;
static char prog[256];
- char *p = string_copy(fsck_path);
+ char *p = xstrdup(fsck_path);
struct stat st;
/* Are we looking for a program or just a type? */
memset(inst, 0, sizeof(struct fsck_instance));
sprintf(prog, "fsck.%s", type);
- argv[0] = string_copy(prog);
+ argv[0] = xstrdup(prog);
argc = 1;
for (i=0; i <num_args; i++)
- argv[argc++] = string_copy(args[i]);
+ argv[argc++] = xstrdup(args[i]);
if (progress) {
if ((strcmp(type, "ext2") == 0) ||
} else if (progress_fd)
snprintf(tmp, 80, "-C%d", progress_fd * -1);
if (tmp[0])
- argv[argc++] = string_copy(tmp);
+ argv[argc++] = xstrdup(tmp);
}
}
- argv[argc++] = string_copy(fs_get_device(fs));
+ argv[argc++] = xstrdup(fs_get_device(fs));
argv[argc] = 0;
s = find_fsck(prog);
free(argv[i]);
inst->pid = pid;
- inst->prog = string_copy(prog);
- inst->type = string_copy(type);
+ inst->prog = xstrdup(prog);
+ inst->type = xstrdup(type);
inst->start_time = time(0);
inst->next = NULL;
if (!fs_type)
return;
- list = string_copy(fs_type);
+ list = xstrdup(fs_type);
num = 0;
s = strtok(list, ",");
while(s) {
#if 0
printf("Adding %s to list (type %d).\n", s, cmp->type[num]);
#endif
- cmp->list[num++] = string_copy(s);
+ cmp->list[num++] = xstrdup(s);
s = strtok(NULL, ",");
}
free(list);
if (!optlist)
return 0;
- list = string_copy(optlist);
+ list = xstrdup(optlist);
s = strtok(list, ",");
while(s) {
_("couldn't find matching filesystem: %s"),
arg);
}
- devices[num_devices++] = dev ? dev : string_copy(arg);
+ devices[num_devices++] = dev ? dev : xstrdup(arg);
continue;
}
if (arg[0] != '-' || opts_for_fsck) {
if (num_args >= MAX_ARGS)
errx(FSCK_EX_ERROR, _("too many arguments"));
- args[num_args++] = string_copy(arg);
+ args[num_args++] = xstrdup(arg);
continue;
}
for (j=1; arg[j]; j++) {
tmp = argv[++i];
else
usage();
- fstype = string_copy(tmp);
+ fstype = xstrdup(tmp);
compile_fs_type(fstype, &fs_type_compiled);
goto next_arg;
case '-':
options[++opt] = '\0';
if (num_args >= MAX_ARGS)
errx(FSCK_EX_ERROR, _("too many arguments"));
- args[num_args++] = string_copy(options);
+ args[num_args++] = xstrdup(options);
opt = 0;
}
}
strcat (fsck_path, ":");
strcat (fsck_path, oldpath);
} else {
- fsck_path = string_copy(fsck_prefix_path);
+ fsck_path = xstrdup(fsck_prefix_path);
}
if ((num_devices == 1) || (serialize))