* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
* 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o.
*
- * %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
- * %End-Header%
+ * Licensed under GPLv2, see file LICENSE in this tarball for details.
*/
#include <sys/types.h>
if (!s)
return 0;
- ret = strdup(s);
+ ret = xstrdup(s);
return ret;
}
int old_fstab = 1;
struct fs_info *fs;
- if ((f = fopen(filename, "r")) == NULL) {
- bb_perror_msg("WARNING: cannot open %s", filename);
+ if ((f = fopen_or_warn(filename, "r")) == NULL) {
return;
}
while (!feof(f)) {
/* Find fsck program for a given fs type. */
static char *find_fsck(char *type)
{
- char *s;
- const char *tpl;
- char *p = string_copy(fsck_path);
- struct stat st;
+ char *s;
+ const char *tpl;
+ char *p = string_copy(fsck_path);
+ struct stat st;
- /* Are we looking for a program or just a type? */
- tpl = (strncmp(type, "fsck.", 5) ? "%s/fsck.%s" : "%s/%s");
+ /* Are we looking for a program or just a type? */
+ tpl = (strncmp(type, "fsck.", 5) ? "%s/fsck.%s" : "%s/%s");
- for(s = strtok(p, ":"); s; s = strtok(NULL, ":")) {
- s = xasprintf(tpl, s, type);
- if (stat(s, &st) == 0) break;
- free(s);
- }
- free(p);
- return s;
+ for (s = strtok(p, ":"); s; s = strtok(NULL, ":")) {
+ s = xasprintf(tpl, s, type);
+ if (stat(s, &st) == 0) break;
+ free(s);
+ }
+ free(p);
+ return s;
}
static int progress_active(void)
if (!interactive)
close(0);
(void) execv(s, argv);
- bb_perror_msg_and_die("%s", argv[0]);
+ bb_simple_perror_msg_and_die(argv[0]);
}
for (i = 1; i < argc; i++)
list = string_copy(fs_type);
num = 0;
s = strtok(list, ",");
- while(s) {
+ while (s) {
negate = 0;
if (strncmp(s, "no", 2) == 0) {
s += 2;
list = string_copy(optlist);
s = strtok(list, ",");
- while(s) {
+ while (s) {
if (strcmp(s, opt) == 0) {
free(list);
return 1;
s = find_fsck(fs->type);
if (s == NULL) {
if (wanted)
- bb_error_msg("cannot check %s: fsck.%s not found",
+ bb_error_msg("can't check %s: fsck.%s not found",
fs->device, fs->type);
return 1;
}
* /proc/partitions isn't found.
*/
if (access("/proc/partitions", R_OK) < 0) {
- bb_perror_msg_and_die("cannot open /proc/partitions "
+ bb_perror_msg_and_die("can't open /proc/partitions "
"(is /proc mounted?)");
}
/*
"must be root to scan for matching filesystems: %s\n", arg);
else
bb_error_msg_and_die(
- "cannot find matching filesystem: %s", arg);
+ "can't find matching filesystem: %s", arg);
}
devices[num_devices++] = dev ? dev : string_copy(arg);
continue;
max_running = atoi(tmp);
}
-int fsck_main(int argc, char **argv);
+int fsck_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int fsck_main(int argc, char **argv)
{
int i, status = 0;