diff options
author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-09-29 09:45:22 +0000 |
---|---|---|
committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-09-29 09:45:22 +0000 |
commit | 6160d45e05d210378f5309e5dcfe372af49d4962 (patch) | |
tree | 5cdfa0e52541c75b3bdf161db0cf5c487f467f9e /e2fsprogs/fsck.c | |
parent | 74078685e6dfb5d084901ebf44351f3c77987f3b (diff) | |
download | busybox-w32-6160d45e05d210378f5309e5dcfe372af49d4962.tar.gz busybox-w32-6160d45e05d210378f5309e5dcfe372af49d4962.tar.bz2 busybox-w32-6160d45e05d210378f5309e5dcfe372af49d4962.zip |
more busybox's style for fsck.c, size reduce
Diffstat (limited to 'e2fsprogs/fsck.c')
-rw-r--r-- | e2fsprogs/fsck.c | 343 |
1 files changed, 142 insertions, 201 deletions
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index b638e4ab9..bb334e3dd 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * parallel execution. | 7 | * parallel execution. |
8 | * | 8 | * |
9 | * Written by Theodore Ts'o, <tytso@mit.edu> | 9 | * Written by Theodore Ts'o, <tytso@mit.edu> |
10 | * | 10 | * |
11 | * Miquel van Smoorenburg (miquels@drinkel.ow.org) 20-Oct-1994: | 11 | * Miquel van Smoorenburg (miquels@drinkel.ow.org) 20-Oct-1994: |
12 | * o Changed -t fstype to behave like with mount when -A (all file | 12 | * o Changed -t fstype to behave like with mount when -A (all file |
13 | * systems) or -M (like mount) is specified. | 13 | * systems) or -M (like mount) is specified. |
@@ -16,8 +16,8 @@ | |||
16 | * can be added without changing this front-end. | 16 | * can be added without changing this front-end. |
17 | * o -R flag skip root file system. | 17 | * o -R flag skip root file system. |
18 | * | 18 | * |
19 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, | 19 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, |
20 | * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. | 20 | * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. |
21 | * | 21 | * |
22 | * %Begin-Header% | 22 | * %Begin-Header% |
23 | * This file may be redistributed under the terms of the GNU Public | 23 | * This file may be redistributed under the terms of the GNU Public |
@@ -48,10 +48,10 @@ | |||
48 | #include "e2fsbb.h" | 48 | #include "e2fsbb.h" |
49 | 49 | ||
50 | #ifndef _PATH_MNTTAB | 50 | #ifndef _PATH_MNTTAB |
51 | #define _PATH_MNTTAB "/etc/fstab" | 51 | #define _PATH_MNTTAB "/etc/fstab" |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | static const char *ignored_types[] = { | 54 | static const char * const ignored_types[] = { |
55 | "ignore", | 55 | "ignore", |
56 | "iso9660", | 56 | "iso9660", |
57 | "nfs", | 57 | "nfs", |
@@ -63,7 +63,7 @@ static const char *ignored_types[] = { | |||
63 | NULL | 63 | NULL |
64 | }; | 64 | }; |
65 | 65 | ||
66 | static const char *really_wanted[] = { | 66 | static const char * const really_wanted[] = { |
67 | "minix", | 67 | "minix", |
68 | "ext2", | 68 | "ext2", |
69 | "ext3", | 69 | "ext3", |
@@ -83,38 +83,35 @@ static char *devices[MAX_DEVICES]; | |||
83 | static char *args[MAX_ARGS]; | 83 | static char *args[MAX_ARGS]; |
84 | static int num_devices, num_args; | 84 | static int num_devices, num_args; |
85 | 85 | ||
86 | static int verbose = 0; | 86 | static int verbose; |
87 | static int doall = 0; | 87 | static int doall; |
88 | static int noexecute = 0; | 88 | static int noexecute; |
89 | static int serialize = 0; | 89 | static int serialize; |
90 | static int skip_root = 0; | 90 | static int skip_root; |
91 | static int like_mount = 0; | 91 | static int like_mount; |
92 | static int notitle = 0; | 92 | static int notitle; |
93 | static int parallel_root = 0; | 93 | static int parallel_root; |
94 | static int progress = 0; | 94 | static int progress; |
95 | static int progress_fd = 0; | 95 | static int progress_fd; |
96 | static int force_all_parallel = 0; | 96 | static int force_all_parallel; |
97 | static int num_running = 0; | 97 | static int num_running; |
98 | static int max_running = 0; | 98 | static int max_running; |
99 | static volatile int cancel_requested = 0; | 99 | static volatile int cancel_requested; |
100 | static int kill_sent = 0; | 100 | static int kill_sent; |
101 | static char *progname; | 101 | static char *fstype; |
102 | static char *fstype = NULL; | 102 | static struct fs_info *filesys_info, *filesys_last; |
103 | static struct fs_info *filesys_info = NULL, *filesys_last = NULL; | ||
104 | static struct fsck_instance *instance_list; | 103 | static struct fsck_instance *instance_list; |
105 | static const char *fsck_prefix_path = "/sbin:/sbin/fs.d:/sbin/fs:/etc/fs:/etc"; | 104 | static const char *fsck_prefix_path = "/sbin:/sbin/fs.d:/sbin/fs:/etc/fs:/etc"; |
106 | static char *fsck_path = 0; | 105 | static char *fsck_path; |
107 | static blkid_cache cache = NULL; | 106 | static blkid_cache cache; |
108 | 107 | ||
109 | static char *string_copy(const char *s) | 108 | static char *string_copy(const char *s) |
110 | { | 109 | { |
111 | char *ret; | 110 | char *ret; |
112 | 111 | ||
113 | if (!s) | 112 | if (!s) |
114 | return 0; | 113 | return 0; |
115 | ret = malloc(strlen(s)+1); | 114 | ret = strdup(s); |
116 | if (ret) | ||
117 | strcpy(ret, s); | ||
118 | return ret; | 115 | return ret; |
119 | } | 116 | } |
120 | 117 | ||
@@ -130,8 +127,6 @@ static int string_to_int(const char *s) | |||
130 | return (int) l; | 127 | return (int) l; |
131 | } | 128 | } |
132 | 129 | ||
133 | static int ignore(struct fs_info *); | ||
134 | |||
135 | static char *skip_over_blank(char *cp) | 130 | static char *skip_over_blank(char *cp) |
136 | { | 131 | { |
137 | while (*cp && isspace(*cp)) | 132 | while (*cp && isspace(*cp)) |
@@ -148,7 +143,7 @@ static char *skip_over_word(char *cp) | |||
148 | 143 | ||
149 | static void strip_line(char *line) | 144 | static void strip_line(char *line) |
150 | { | 145 | { |
151 | char *p; | 146 | char *p; |
152 | 147 | ||
153 | while (*line) { | 148 | while (*line) { |
154 | p = line + strlen(line) - 1; | 149 | p = line + strlen(line) - 1; |
@@ -177,38 +172,19 @@ static char *parse_word(char **buf) | |||
177 | 172 | ||
178 | static void parse_escape(char *word) | 173 | static void parse_escape(char *word) |
179 | { | 174 | { |
180 | char *p, *q; | 175 | char *q, c; |
181 | int ac, i; | 176 | const char *p; |
182 | 177 | ||
183 | if (!word) | 178 | if (!word) |
184 | return; | 179 | return; |
185 | 180 | ||
186 | for (p = word, q = word; *p; p++, q++) { | 181 | for (p = q = word; *p; q++) { |
187 | *q = *p; | 182 | c = *p++; |
188 | if (*p != '\\') | 183 | if (c != '\\') { |
189 | continue; | 184 | *q = c; |
190 | if (*++p == 0) | 185 | } else { |
191 | break; | 186 | *q = bb_process_escape_sequence(&p); |
192 | if (*p == 't') { | ||
193 | *q = '\t'; | ||
194 | continue; | ||
195 | } | ||
196 | if (*p == 'n') { | ||
197 | *q = '\n'; | ||
198 | continue; | ||
199 | } | ||
200 | if (!isdigit(*p)) { | ||
201 | *q = *p; | ||
202 | continue; | ||
203 | } | ||
204 | ac = 0; | ||
205 | for (i = 0; i < 3; i++, p++) { | ||
206 | if (!isdigit(*p)) | ||
207 | break; | ||
208 | ac = (ac * 8) + (*p - '0'); | ||
209 | } | 187 | } |
210 | *q = ac; | ||
211 | p--; | ||
212 | } | 188 | } |
213 | *q = 0; | 189 | *q = 0; |
214 | } | 190 | } |
@@ -226,7 +202,7 @@ static void free_instance(struct fsck_instance *i) | |||
226 | } | 202 | } |
227 | 203 | ||
228 | static struct fs_info *create_fs_device(const char *device, const char *mntpnt, | 204 | static struct fs_info *create_fs_device(const char *device, const char *mntpnt, |
229 | const char *type, const char *opts, | 205 | const char *type, const char *opts, |
230 | int freq, int passno) | 206 | int freq, int passno) |
231 | { | 207 | { |
232 | struct fs_info *fs; | 208 | struct fs_info *fs; |
@@ -256,13 +232,13 @@ static struct fs_info *create_fs_device(const char *device, const char *mntpnt, | |||
256 | 232 | ||
257 | static int parse_fstab_line(char *line, struct fs_info **ret_fs) | 233 | static int parse_fstab_line(char *line, struct fs_info **ret_fs) |
258 | { | 234 | { |
259 | char *dev, *device, *mntpnt, *type, *opts, *freq, *passno, *cp; | 235 | char *dev, *device, *mntpnt, *type, *opts, *freq, *passno, *cp; |
260 | struct fs_info *fs; | 236 | struct fs_info *fs; |
261 | 237 | ||
262 | *ret_fs = 0; | 238 | *ret_fs = 0; |
263 | strip_line(line); | 239 | strip_line(line); |
264 | if ((cp = strchr(line, '#'))) | 240 | if ((cp = strchr(line, '#'))) |
265 | *cp = 0; /* Ignore everything after the comment char */ | 241 | *cp = 0; /* Ignore everything after the comment char */ |
266 | cp = line; | 242 | cp = line; |
267 | 243 | ||
268 | device = parse_word(&cp); | 244 | device = parse_word(&cp); |
@@ -273,8 +249,8 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs) | |||
273 | passno = parse_word(&cp); | 249 | passno = parse_word(&cp); |
274 | 250 | ||
275 | if (!device) | 251 | if (!device) |
276 | return 0; /* Allow blank lines */ | 252 | return 0; /* Allow blank lines */ |
277 | 253 | ||
278 | if (!mntpnt || !type) | 254 | if (!mntpnt || !type) |
279 | return -1; | 255 | return -1; |
280 | 256 | ||
@@ -297,7 +273,7 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs) | |||
297 | passno ? atoi(passno) : -1); | 273 | passno ? atoi(passno) : -1); |
298 | if (dev) | 274 | if (dev) |
299 | free(dev); | 275 | free(dev); |
300 | 276 | ||
301 | if (!fs) | 277 | if (!fs) |
302 | return -1; | 278 | return -1; |
303 | *ret_fs = fs; | 279 | *ret_fs = fs; |
@@ -306,8 +282,8 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs) | |||
306 | 282 | ||
307 | static void interpret_type(struct fs_info *fs) | 283 | static void interpret_type(struct fs_info *fs) |
308 | { | 284 | { |
309 | char *t; | 285 | char *t; |
310 | 286 | ||
311 | if (strcmp(fs->type, "auto") != 0) | 287 | if (strcmp(fs->type, "auto") != 0) |
312 | return; | 288 | return; |
313 | t = blkid_get_tag_value(cache, "TYPE", fs->device); | 289 | t = blkid_get_tag_value(cache, "TYPE", fs->device); |
@@ -322,15 +298,14 @@ static void interpret_type(struct fs_info *fs) | |||
322 | */ | 298 | */ |
323 | static void load_fs_info(const char *filename) | 299 | static void load_fs_info(const char *filename) |
324 | { | 300 | { |
325 | FILE *f; | 301 | FILE *f; |
326 | char buf[1024]; | 302 | char buf[1024]; |
327 | int lineno = 0; | 303 | int lineno = 0; |
328 | int old_fstab = 1; | 304 | int old_fstab = 1; |
329 | struct fs_info *fs; | 305 | struct fs_info *fs; |
330 | 306 | ||
331 | if ((f = fopen(filename, "r")) == NULL) { | 307 | if ((f = fopen(filename, "r")) == NULL) { |
332 | fprintf(stderr, _("WARNING: couldn't open %s: %s\n"), | 308 | bb_perror_msg("WARNING: couldn't open %s: %m", filename); |
333 | filename, strerror(errno)); | ||
334 | return; | 309 | return; |
335 | } | 310 | } |
336 | while (!feof(f)) { | 311 | while (!feof(f)) { |
@@ -339,8 +314,8 @@ static void load_fs_info(const char *filename) | |||
339 | break; | 314 | break; |
340 | buf[sizeof(buf)-1] = 0; | 315 | buf[sizeof(buf)-1] = 0; |
341 | if (parse_fstab_line(buf, &fs) < 0) { | 316 | if (parse_fstab_line(buf, &fs) < 0) { |
342 | fprintf(stderr, _("WARNING: bad format " | 317 | bb_error_msg("WARNING: bad format " |
343 | "on line %d of %s\n"), lineno, filename); | 318 | "on line %d of %s\n", lineno, filename); |
344 | continue; | 319 | continue; |
345 | } | 320 | } |
346 | if (!fs) | 321 | if (!fs) |
@@ -350,21 +325,21 @@ static void load_fs_info(const char *filename) | |||
350 | else | 325 | else |
351 | old_fstab = 0; | 326 | old_fstab = 0; |
352 | } | 327 | } |
353 | 328 | ||
354 | fclose(f); | 329 | fclose(f); |
355 | 330 | ||
356 | if (old_fstab) { | 331 | if (old_fstab) { |
357 | fputs(_("\007\007\007" | 332 | fputs("\007\007\007" |
358 | "WARNING: Your /etc/fstab does not contain the fsck passno\n" | 333 | "WARNING: Your /etc/fstab does not contain the fsck passno\n" |
359 | " field. I will kludge around things for you, but you\n" | 334 | " field. I will kludge around things for you, but you\n" |
360 | " should fix your /etc/fstab file as soon as you can.\n\n"), stderr); | 335 | " should fix your /etc/fstab file as soon as you can.\n\n", stderr); |
361 | 336 | ||
362 | for (fs = filesys_info; fs; fs = fs->next) { | 337 | for (fs = filesys_info; fs; fs = fs->next) { |
363 | fs->passno = 1; | 338 | fs->passno = 1; |
364 | } | 339 | } |
365 | } | 340 | } |
366 | } | 341 | } |
367 | 342 | ||
368 | /* Lookup filesys in /etc/fstab and return the corresponding entry. */ | 343 | /* Lookup filesys in /etc/fstab and return the corresponding entry. */ |
369 | static struct fs_info *lookup(char *filesys) | 344 | static struct fs_info *lookup(char *filesys) |
370 | { | 345 | { |
@@ -388,7 +363,7 @@ static char *find_fsck(char *type) | |||
388 | { | 363 | { |
389 | char *s; | 364 | char *s; |
390 | const char *tpl; | 365 | const char *tpl; |
391 | static char prog[256]; | 366 | char *prog; |
392 | char *p = string_copy(fsck_path); | 367 | char *p = string_copy(fsck_path); |
393 | struct stat st; | 368 | struct stat st; |
394 | 369 | ||
@@ -396,8 +371,9 @@ static char *find_fsck(char *type) | |||
396 | tpl = (strncmp(type, "fsck.", 5) ? "%s/fsck.%s" : "%s/%s"); | 371 | tpl = (strncmp(type, "fsck.", 5) ? "%s/fsck.%s" : "%s/%s"); |
397 | 372 | ||
398 | for(s = strtok(p, ":"); s; s = strtok(NULL, ":")) { | 373 | for(s = strtok(p, ":"); s; s = strtok(NULL, ":")) { |
399 | sprintf(prog, tpl, s, type); | 374 | bb_xasprintf(&prog, tpl, s, type); |
400 | if (stat(prog, &st) == 0) break; | 375 | if (stat(prog, &st) == 0) break; |
376 | free(prog); | ||
401 | } | 377 | } |
402 | free(p); | 378 | free(p); |
403 | return(s ? prog : NULL); | 379 | return(s ? prog : NULL); |
@@ -423,20 +399,21 @@ static int progress_active(void) | |||
423 | static int execute(const char *type, const char *device, const char *mntpt, | 399 | static int execute(const char *type, const char *device, const char *mntpt, |
424 | int interactive) | 400 | int interactive) |
425 | { | 401 | { |
426 | char *s, *argv[80], prog[80]; | 402 | char *s, *argv[80]; |
403 | char *prog; | ||
427 | int argc, i; | 404 | int argc, i; |
428 | struct fsck_instance *inst, *p; | 405 | struct fsck_instance *inst, *p; |
429 | pid_t pid; | 406 | pid_t pid; |
430 | 407 | ||
431 | inst = malloc(sizeof(struct fsck_instance)); | 408 | inst = malloc(sizeof(struct fsck_instance)); |
432 | if (!inst) | 409 | if (!inst) |
433 | return ENOMEM; | 410 | return ENOMEM; |
434 | memset(inst, 0, sizeof(struct fsck_instance)); | 411 | memset(inst, 0, sizeof(struct fsck_instance)); |
435 | 412 | ||
436 | sprintf(prog, "fsck.%s", type); | 413 | bb_xasprintf(&prog, "fsck.%s", type); |
437 | argv[0] = string_copy(prog); | 414 | argv[0] = prog; |
438 | argc = 1; | 415 | argc = 1; |
439 | 416 | ||
440 | for (i=0; i <num_args; i++) | 417 | for (i=0; i <num_args; i++) |
441 | argv[argc++] = string_copy(args[i]); | 418 | argv[argc++] = string_copy(args[i]); |
442 | 419 | ||
@@ -455,7 +432,7 @@ static int execute(const char *type, const char *device, const char *mntpt, | |||
455 | 432 | ||
456 | s = find_fsck(prog); | 433 | s = find_fsck(prog); |
457 | if (s == NULL) { | 434 | if (s == NULL) { |
458 | fprintf(stderr, _("fsck: %s: not found\n"), prog); | 435 | bb_error_msg("%s: not found", prog); |
459 | return ENOENT; | 436 | return ENOENT; |
460 | } | 437 | } |
461 | 438 | ||
@@ -466,7 +443,7 @@ static int execute(const char *type, const char *device, const char *mntpt, | |||
466 | printf("%s ", argv[i]); | 443 | printf("%s ", argv[i]); |
467 | printf("\n"); | 444 | printf("\n"); |
468 | } | 445 | } |
469 | 446 | ||
470 | /* Fork and execute the correct program. */ | 447 | /* Fork and execute the correct program. */ |
471 | if (noexecute) | 448 | if (noexecute) |
472 | pid = -1; | 449 | pid = -1; |
@@ -477,15 +454,15 @@ static int execute(const char *type, const char *device, const char *mntpt, | |||
477 | if (!interactive) | 454 | if (!interactive) |
478 | close(0); | 455 | close(0); |
479 | (void) execv(s, argv); | 456 | (void) execv(s, argv); |
480 | perror(argv[0]); | 457 | bb_perror_msg_and_die("%s", argv[0]); |
481 | exit(EXIT_ERROR); | ||
482 | } | 458 | } |
483 | 459 | ||
484 | for (i=0; i < argc; i++) | 460 | for (i = 1; i < argc; i++) |
485 | free(argv[i]); | 461 | free(argv[i]); |
486 | 462 | ||
463 | free(s); | ||
487 | inst->pid = pid; | 464 | inst->pid = pid; |
488 | inst->prog = string_copy(prog); | 465 | inst->prog = prog; |
489 | inst->type = string_copy(type); | 466 | inst->type = string_copy(type); |
490 | inst->device = string_copy(device); | 467 | inst->device = string_copy(device); |
491 | inst->base_device = base_device(device); | 468 | inst->base_device = base_device(device); |
@@ -501,7 +478,7 @@ static int execute(const char *type, const char *device, const char *mntpt, | |||
501 | p->next = inst; | 478 | p->next = inst; |
502 | else | 479 | else |
503 | instance_list = inst; | 480 | instance_list = inst; |
504 | 481 | ||
505 | return 0; | 482 | return 0; |
506 | } | 483 | } |
507 | 484 | ||
@@ -511,7 +488,7 @@ static int execute(const char *type, const char *device, const char *mntpt, | |||
511 | static int kill_all(int signum) | 488 | static int kill_all(int signum) |
512 | { | 489 | { |
513 | struct fsck_instance *inst; | 490 | struct fsck_instance *inst; |
514 | int n = 0; | 491 | int n = 0; |
515 | 492 | ||
516 | for (inst = instance_list; inst; inst = inst->next) { | 493 | for (inst = instance_list; inst; inst = inst->next) { |
517 | if (inst->flags & FLAG_DONE) | 494 | if (inst->flags & FLAG_DONE) |
@@ -528,10 +505,10 @@ static int kill_all(int signum) | |||
528 | */ | 505 | */ |
529 | static struct fsck_instance *wait_one(int flags) | 506 | static struct fsck_instance *wait_one(int flags) |
530 | { | 507 | { |
531 | int status; | 508 | int status; |
532 | int sig; | 509 | int sig; |
533 | struct fsck_instance *inst, *inst2, *prev; | 510 | struct fsck_instance *inst, *inst2, *prev; |
534 | pid_t pid; | 511 | pid_t pid; |
535 | 512 | ||
536 | if (!instance_list) | 513 | if (!instance_list) |
537 | return NULL; | 514 | return NULL; |
@@ -554,7 +531,7 @@ static struct fsck_instance *wait_one(int flags) | |||
554 | * (inst and prev are thought to be uninitialized variables) | 531 | * (inst and prev are thought to be uninitialized variables) |
555 | */ | 532 | */ |
556 | inst = prev = NULL; | 533 | inst = prev = NULL; |
557 | 534 | ||
558 | do { | 535 | do { |
559 | pid = waitpid(-1, &status, flags); | 536 | pid = waitpid(-1, &status, flags); |
560 | if (cancel_requested && !kill_sent) { | 537 | if (cancel_requested && !kill_sent) { |
@@ -567,9 +544,7 @@ static struct fsck_instance *wait_one(int flags) | |||
567 | if ((errno == EINTR) || (errno == EAGAIN)) | 544 | if ((errno == EINTR) || (errno == EAGAIN)) |
568 | continue; | 545 | continue; |
569 | if (errno == ECHILD) { | 546 | if (errno == ECHILD) { |
570 | fprintf(stderr, | 547 | bb_error_msg("wait: No more child process?!?"); |
571 | _("%s: wait: No more child process?!?\n"), | ||
572 | progname); | ||
573 | return NULL; | 548 | return NULL; |
574 | } | 549 | } |
575 | perror("wait"); | 550 | perror("wait"); |
@@ -583,20 +558,20 @@ static struct fsck_instance *wait_one(int flags) | |||
583 | } | 558 | } |
584 | } while (!inst); | 559 | } while (!inst); |
585 | 560 | ||
586 | if (WIFEXITED(status)) | 561 | if (WIFEXITED(status)) |
587 | status = WEXITSTATUS(status); | 562 | status = WEXITSTATUS(status); |
588 | else if (WIFSIGNALED(status)) { | 563 | else if (WIFSIGNALED(status)) { |
589 | sig = WTERMSIG(status); | 564 | sig = WTERMSIG(status); |
590 | if (sig == SIGINT) { | 565 | if (sig == SIGINT) { |
591 | status = EXIT_UNCORRECTED; | 566 | status = EXIT_UNCORRECTED; |
592 | } else { | 567 | } else { |
593 | printf(_("Warning... %s for device %s exited " | 568 | printf("Warning... %s for device %s exited " |
594 | "with signal %d.\n"), | 569 | "with signal %d.\n", |
595 | inst->prog, inst->device, sig); | 570 | inst->prog, inst->device, sig); |
596 | status = EXIT_ERROR; | 571 | status = EXIT_ERROR; |
597 | } | 572 | } |
598 | } else { | 573 | } else { |
599 | printf(_("%s %s: status is %x, should never happen.\n"), | 574 | printf("%s %s: status is %x, should never happen.\n", |
600 | inst->prog, inst->device, status); | 575 | inst->prog, inst->device, status); |
601 | status = EXIT_ERROR; | 576 | status = EXIT_ERROR; |
602 | } | 577 | } |
@@ -632,14 +607,14 @@ ret_inst: | |||
632 | else | 607 | else |
633 | instance_list = inst->next; | 608 | instance_list = inst->next; |
634 | if (verbose > 1) | 609 | if (verbose > 1) |
635 | printf(_("Finished with %s (exit status %d)\n"), | 610 | printf("Finished with %s (exit status %d)\n", |
636 | inst->device, inst->exit_status); | 611 | inst->device, inst->exit_status); |
637 | num_running--; | 612 | num_running--; |
638 | return inst; | 613 | return inst; |
639 | } | 614 | } |
640 | 615 | ||
641 | #define FLAG_WAIT_ALL 0 | 616 | #define FLAG_WAIT_ALL 0 |
642 | #define FLAG_WAIT_ATLEAST_ONE 1 | 617 | #define FLAG_WAIT_ATLEAST_ONE 1 |
643 | /* | 618 | /* |
644 | * Wait until all executing child processes have exited; return the | 619 | * Wait until all executing child processes have exited; return the |
645 | * logical OR of all of their exit code values. | 620 | * logical OR of all of their exit code values. |
@@ -647,8 +622,8 @@ ret_inst: | |||
647 | static int wait_many(int flags) | 622 | static int wait_many(int flags) |
648 | { | 623 | { |
649 | struct fsck_instance *inst; | 624 | struct fsck_instance *inst; |
650 | int global_status = 0; | 625 | int global_status = 0; |
651 | int wait_flags = 0; | 626 | int wait_flags = 0; |
652 | 627 | ||
653 | while ((inst = wait_one(wait_flags))) { | 628 | while ((inst = wait_one(wait_flags))) { |
654 | global_status |= inst->exit_status; | 629 | global_status |= inst->exit_status; |
@@ -665,11 +640,11 @@ static int wait_many(int flags) | |||
665 | 640 | ||
666 | /* | 641 | /* |
667 | * Run the fsck program on a particular device | 642 | * Run the fsck program on a particular device |
668 | * | 643 | * |
669 | * If the type is specified using -t, and it isn't prefixed with "no" | 644 | * If the type is specified using -t, and it isn't prefixed with "no" |
670 | * (as in "noext2") and only one filesystem type is specified, then | 645 | * (as in "noext2") and only one filesystem type is specified, then |
671 | * use that type regardless of what is specified in /etc/fstab. | 646 | * use that type regardless of what is specified in /etc/fstab. |
672 | * | 647 | * |
673 | * If the type isn't specified by the user, then use either the type | 648 | * If the type isn't specified by the user, then use either the type |
674 | * specified in /etc/fstab, or DEFAULT_FSTYPE. | 649 | * specified in /etc/fstab, or DEFAULT_FSTYPE. |
675 | */ | 650 | */ |
@@ -683,7 +658,7 @@ static void fsck_device(struct fs_info *fs, int interactive) | |||
683 | if (strcmp(fs->type, "auto") != 0) | 658 | if (strcmp(fs->type, "auto") != 0) |
684 | type = fs->type; | 659 | type = fs->type; |
685 | else if (fstype && strncmp(fstype, "no", 2) && | 660 | else if (fstype && strncmp(fstype, "no", 2) && |
686 | strncmp(fstype, "opts=", 5) && strncmp(fstype, "loop", 4) && | 661 | strncmp(fstype, "opts=", 5) && strncmp(fstype, "loop", 4) && |
687 | !strchr(fstype, ',')) | 662 | !strchr(fstype, ',')) |
688 | type = fstype; | 663 | type = fstype; |
689 | else | 664 | else |
@@ -692,8 +667,8 @@ static void fsck_device(struct fs_info *fs, int interactive) | |||
692 | num_running++; | 667 | num_running++; |
693 | retval = execute(type, fs->device, fs->mountpt, interactive); | 668 | retval = execute(type, fs->device, fs->mountpt, interactive); |
694 | if (retval) { | 669 | if (retval) { |
695 | fprintf(stderr, _("%s: Error %d while executing fsck.%s " | 670 | bb_error_msg("Error %d while executing fsck.%s for %s", |
696 | "for %s\n"), progname, retval, type, fs->device); | 671 | retval, type, fs->device); |
697 | num_running--; | 672 | num_running--; |
698 | } | 673 | } |
699 | } | 674 | } |
@@ -708,9 +683,9 @@ struct fs_type_compile { | |||
708 | int negate; | 683 | int negate; |
709 | } fs_type_compiled; | 684 | } fs_type_compiled; |
710 | 685 | ||
711 | #define FS_TYPE_NORMAL 0 | 686 | #define FS_TYPE_NORMAL 0 |
712 | #define FS_TYPE_OPT 1 | 687 | #define FS_TYPE_OPT 1 |
713 | #define FS_TYPE_NEGOPT 2 | 688 | #define FS_TYPE_NEGOPT 2 |
714 | 689 | ||
715 | static const char *fs_type_syntax_error = | 690 | static const char *fs_type_syntax_error = |
716 | N_("Either all or none of the filesystem types passed to -t must be prefixed\n" | 691 | N_("Either all or none of the filesystem types passed to -t must be prefixed\n" |
@@ -718,9 +693,9 @@ N_("Either all or none of the filesystem types passed to -t must be prefixed\n" | |||
718 | 693 | ||
719 | static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp) | 694 | static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp) |
720 | { | 695 | { |
721 | char *cp, *list, *s; | 696 | char *cp, *list, *s; |
722 | int num = 2; | 697 | int num = 2; |
723 | int negate, first_negate = 1; | 698 | int negate, first_negate = 1; |
724 | 699 | ||
725 | if (fs_type) { | 700 | if (fs_type) { |
726 | for (cp=fs_type; *cp; cp++) { | 701 | for (cp=fs_type; *cp; cp++) { |
@@ -729,20 +704,13 @@ static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp) | |||
729 | } | 704 | } |
730 | } | 705 | } |
731 | 706 | ||
732 | cmp->list = malloc(num * sizeof(char *)); | 707 | cmp->list = xcalloc(num, sizeof(char *)); |
733 | cmp->type = malloc(num * sizeof(int)); | 708 | cmp->type = xcalloc(num, sizeof(int)); |
734 | if (!cmp->list || !cmp->type) { | ||
735 | fputs(_("Couldn't allocate memory for filesystem types\n"), | ||
736 | stderr); | ||
737 | exit(EXIT_ERROR); | ||
738 | } | ||
739 | memset(cmp->list, 0, num * sizeof(char *)); | ||
740 | memset(cmp->type, 0, num * sizeof(int)); | ||
741 | cmp->negate = 0; | 709 | cmp->negate = 0; |
742 | 710 | ||
743 | if (!fs_type) | 711 | if (!fs_type) |
744 | return; | 712 | return; |
745 | 713 | ||
746 | list = string_copy(fs_type); | 714 | list = string_copy(fs_type); |
747 | num = 0; | 715 | num = 0; |
748 | s = strtok(list, ","); | 716 | s = strtok(list, ","); |
@@ -769,14 +737,13 @@ static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp) | |||
769 | } | 737 | } |
770 | if ((negate && !cmp->negate) || | 738 | if ((negate && !cmp->negate) || |
771 | (!negate && cmp->negate)) { | 739 | (!negate && cmp->negate)) { |
772 | fputs(_(fs_type_syntax_error), stderr); | 740 | bb_error_msg_and_die("%s", fs_type_syntax_error); |
773 | exit(EXIT_USAGE); | ||
774 | } | 741 | } |
775 | } | 742 | } |
776 | #if 0 | 743 | #if 0 |
777 | printf("Adding %s to list (type %d).\n", s, cmp->type[num]); | 744 | printf("Adding %s to list (type %d).\n", s, cmp->type[num]); |
778 | #endif | 745 | #endif |
779 | cmp->list[num++] = string_copy(s); | 746 | cmp->list[num++] = string_copy(s); |
780 | s = strtok(NULL, ","); | 747 | s = strtok(NULL, ","); |
781 | } | 748 | } |
782 | free(list); | 749 | free(list); |
@@ -788,12 +755,12 @@ static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp) | |||
788 | */ | 755 | */ |
789 | static int opt_in_list(char *opt, char *optlist) | 756 | static int opt_in_list(char *opt, char *optlist) |
790 | { | 757 | { |
791 | char *list, *s; | 758 | char *list, *s; |
792 | 759 | ||
793 | if (!optlist) | 760 | if (!optlist) |
794 | return 0; | 761 | return 0; |
795 | list = string_copy(optlist); | 762 | list = string_copy(optlist); |
796 | 763 | ||
797 | s = strtok(list, ","); | 764 | s = strtok(list, ","); |
798 | while(s) { | 765 | while(s) { |
799 | if (strcmp(s, opt) == 0) { | 766 | if (strcmp(s, opt) == 0) { |
@@ -802,7 +769,7 @@ static int opt_in_list(char *opt, char *optlist) | |||
802 | } | 769 | } |
803 | s = strtok(NULL, ","); | 770 | s = strtok(NULL, ","); |
804 | } | 771 | } |
805 | free(list); | 772 | free(list); |
806 | return 0; | 773 | return 0; |
807 | } | 774 | } |
808 | 775 | ||
@@ -841,8 +808,9 @@ static int fs_match(struct fs_info *fs, struct fs_type_compile *cmp) | |||
841 | /* Check if we should ignore this filesystem. */ | 808 | /* Check if we should ignore this filesystem. */ |
842 | static int ignore(struct fs_info *fs) | 809 | static int ignore(struct fs_info *fs) |
843 | { | 810 | { |
844 | const char **ip; | 811 | const char * const *ip; |
845 | int wanted = 0; | 812 | int wanted = 0; |
813 | char *s; | ||
846 | 814 | ||
847 | /* | 815 | /* |
848 | * If the pass number is 0, ignore it. | 816 | * If the pass number is 0, ignore it. |
@@ -857,7 +825,7 @@ static int ignore(struct fs_info *fs) | |||
857 | * ignore it. | 825 | * ignore it. |
858 | */ | 826 | */ |
859 | if (!fs_match(fs, &fs_type_compiled)) return 1; | 827 | if (!fs_match(fs, &fs_type_compiled)) return 1; |
860 | 828 | ||
861 | /* Are we ignoring this type? */ | 829 | /* Are we ignoring this type? */ |
862 | for(ip = ignored_types; *ip; ip++) | 830 | for(ip = ignored_types; *ip; ip++) |
863 | if (strcmp(fs->type, *ip) == 0) return 1; | 831 | if (strcmp(fs->type, *ip) == 0) return 1; |
@@ -870,12 +838,14 @@ static int ignore(struct fs_info *fs) | |||
870 | } | 838 | } |
871 | 839 | ||
872 | /* See if the <fsck.fs> program is available. */ | 840 | /* See if the <fsck.fs> program is available. */ |
873 | if (find_fsck(fs->type) == NULL) { | 841 | s = find_fsck(fs->type); |
842 | if (s == NULL) { | ||
874 | if (wanted) | 843 | if (wanted) |
875 | fprintf(stderr, _("fsck: cannot check %s: fsck.%s not found\n"), | 844 | bb_error_msg("cannot check %s: fsck.%s not found", |
876 | fs->device, fs->type); | 845 | fs->device, fs->type); |
877 | return 1; | 846 | return 1; |
878 | } | 847 | } |
848 | free(s); | ||
879 | 849 | ||
880 | /* We can and want to check this file system type. */ | 850 | /* We can and want to check this file system type. */ |
881 | return 0; | 851 | return 0; |
@@ -906,7 +876,7 @@ static int device_already_active(char *device) | |||
906 | * If we don't know the base device, assume that the device is | 876 | * If we don't know the base device, assume that the device is |
907 | * already active if there are any fsck instances running. | 877 | * already active if there are any fsck instances running. |
908 | */ | 878 | */ |
909 | if (!base) | 879 | if (!base) |
910 | return (instance_list != 0); | 880 | return (instance_list != 0); |
911 | for (inst = instance_list; inst; inst = inst->next) { | 881 | for (inst = instance_list; inst; inst = inst->next) { |
912 | if (!inst->base_device || !strcmp(base, inst->base_device)) { | 882 | if (!inst->base_device || !strcmp(base, inst->base_device)) { |
@@ -928,7 +898,7 @@ static int check_all(void) | |||
928 | int pass_done; | 898 | int pass_done; |
929 | 899 | ||
930 | if (verbose) | 900 | if (verbose) |
931 | fputs(_("Checking all file systems.\n"), stdout); | 901 | fputs("Checking all file systems.\n", stdout); |
932 | 902 | ||
933 | /* | 903 | /* |
934 | * Do an initial scan over the filesystem; mark filesystems | 904 | * Do an initial scan over the filesystem; mark filesystems |
@@ -939,7 +909,7 @@ static int check_all(void) | |||
939 | if (ignore(fs)) | 909 | if (ignore(fs)) |
940 | fs->flags |= FLAG_DONE; | 910 | fs->flags |= FLAG_DONE; |
941 | } | 911 | } |
942 | 912 | ||
943 | /* | 913 | /* |
944 | * Find and check the root filesystem. | 914 | * Find and check the root filesystem. |
945 | */ | 915 | */ |
@@ -1014,11 +984,11 @@ static int check_all(void) | |||
1014 | if (cancel_requested) | 984 | if (cancel_requested) |
1015 | break; | 985 | break; |
1016 | if (verbose > 1) | 986 | if (verbose > 1) |
1017 | printf(_("--waiting-- (pass %d)\n"), passno); | 987 | printf("--waiting-- (pass %d)\n", passno); |
1018 | status |= wait_many(pass_done ? FLAG_WAIT_ALL : | 988 | status |= wait_many(pass_done ? FLAG_WAIT_ALL : |
1019 | FLAG_WAIT_ATLEAST_ONE); | 989 | FLAG_WAIT_ATLEAST_ONE); |
1020 | if (pass_done) { | 990 | if (pass_done) { |
1021 | if (verbose > 1) | 991 | if (verbose > 1) |
1022 | printf("----------------------------------\n"); | 992 | printf("----------------------------------\n"); |
1023 | passno++; | 993 | passno++; |
1024 | } else | 994 | } else |
@@ -1035,27 +1005,24 @@ static int check_all(void) | |||
1035 | #if 0 | 1005 | #if 0 |
1036 | static void usage(void) | 1006 | static void usage(void) |
1037 | { | 1007 | { |
1038 | fputs(_("Usage: fsck [-ANPRTV] [ -C [ fd ] ] [-t fstype] [fs-options] [filesys ...]\n"), stderr); | 1008 | fputs("Usage: fsck [-ANPRTV] [ -C [ fd ] ] [-t fstype] [fs-options] [filesys ...]\n", stderr); |
1039 | exit(EXIT_USAGE); | 1009 | exit(EXIT_USAGE); |
1040 | } | 1010 | } |
1041 | #endif | 1011 | #endif |
1042 | 1012 | ||
1043 | #ifdef HAVE_SIGNAL_H | ||
1044 | static void signal_cancel(int sig FSCK_ATTR((unused))) | 1013 | static void signal_cancel(int sig FSCK_ATTR((unused))) |
1045 | { | 1014 | { |
1046 | cancel_requested++; | 1015 | cancel_requested++; |
1047 | } | 1016 | } |
1048 | #endif | ||
1049 | 1017 | ||
1050 | static void PRS(int argc, char *argv[]) | 1018 | static void PRS(int argc, char *argv[]) |
1051 | { | 1019 | { |
1052 | int i, j; | 1020 | int i, j; |
1053 | char *arg, *dev, *tmp = 0; | 1021 | char *arg, *dev, *tmp = 0; |
1054 | char options[128]; | 1022 | char options[128]; |
1055 | int opt = 0; | 1023 | int opt = 0; |
1056 | int opts_for_fsck = 0; | 1024 | int opts_for_fsck = 0; |
1057 | #ifdef HAVE_SIGNAL_H | 1025 | struct sigaction sa; |
1058 | struct sigaction sa; | ||
1059 | 1026 | ||
1060 | /* | 1027 | /* |
1061 | * Set up signal action | 1028 | * Set up signal action |
@@ -1064,23 +1031,18 @@ static void PRS(int argc, char *argv[]) | |||
1064 | sa.sa_handler = signal_cancel; | 1031 | sa.sa_handler = signal_cancel; |
1065 | sigaction(SIGINT, &sa, 0); | 1032 | sigaction(SIGINT, &sa, 0); |
1066 | sigaction(SIGTERM, &sa, 0); | 1033 | sigaction(SIGTERM, &sa, 0); |
1067 | #endif | 1034 | |
1068 | |||
1069 | num_devices = 0; | 1035 | num_devices = 0; |
1070 | num_args = 0; | 1036 | num_args = 0; |
1071 | instance_list = 0; | 1037 | instance_list = 0; |
1072 | 1038 | ||
1073 | progname = argv[0]; | ||
1074 | |||
1075 | for (i=1; i < argc; i++) { | 1039 | for (i=1; i < argc; i++) { |
1076 | arg = argv[i]; | 1040 | arg = argv[i]; |
1077 | if (!arg) | 1041 | if (!arg) |
1078 | continue; | 1042 | continue; |
1079 | if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) { | 1043 | if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) { |
1080 | if (num_devices >= MAX_DEVICES) { | 1044 | if (num_devices >= MAX_DEVICES) { |
1081 | fprintf(stderr, _("%s: too many devices\n"), | 1045 | bb_error_msg_and_die("too many devices"); |
1082 | progname); | ||
1083 | exit(EXIT_ERROR); | ||
1084 | } | 1046 | } |
1085 | dev = blkid_get_devname(cache, arg, NULL); | 1047 | dev = blkid_get_devname(cache, arg, NULL); |
1086 | if (!dev && strchr(arg, '=')) { | 1048 | if (!dev && strchr(arg, '=')) { |
@@ -1089,31 +1051,26 @@ static void PRS(int argc, char *argv[]) | |||
1089 | * /proc/partitions isn't found. | 1051 | * /proc/partitions isn't found. |
1090 | */ | 1052 | */ |
1091 | if (access("/proc/partitions", R_OK) < 0) { | 1053 | if (access("/proc/partitions", R_OK) < 0) { |
1092 | fprintf(stderr, "Couldn't open /proc/partitions: %s\n", | 1054 | bb_error_msg_and_die("Couldn't open /proc/partitions: %m\n" |
1093 | strerror(errno)); | 1055 | "Is /proc mounted?"); |
1094 | fprintf(stderr, "Is /proc mounted?\n"); | ||
1095 | exit(EXIT_ERROR); | ||
1096 | } | 1056 | } |
1097 | /* | 1057 | /* |
1098 | * Check to see if this is because | 1058 | * Check to see if this is because |
1099 | * we're not running as root | 1059 | * we're not running as root |
1100 | */ | 1060 | */ |
1101 | if (geteuid()) | 1061 | if (geteuid()) |
1102 | fprintf(stderr, | 1062 | bb_error_msg_and_die( |
1103 | "Must be root to scan for matching filesystems: %s\n", arg); | 1063 | "Must be root to scan for matching filesystems: %s\n", arg); |
1104 | else | 1064 | else |
1105 | fprintf(stderr, | 1065 | bb_error_msg_and_die( |
1106 | "Couldn't find matching filesystem: %s\n", arg); | 1066 | "Couldn't find matching filesystem: %s", arg); |
1107 | exit(EXIT_ERROR); | ||
1108 | } | 1067 | } |
1109 | devices[num_devices++] = dev ? dev : string_copy(arg); | 1068 | devices[num_devices++] = dev ? dev : string_copy(arg); |
1110 | continue; | 1069 | continue; |
1111 | } | 1070 | } |
1112 | if (arg[0] != '-' || opts_for_fsck) { | 1071 | if (arg[0] != '-' || opts_for_fsck) { |
1113 | if (num_args >= MAX_ARGS) { | 1072 | if (num_args >= MAX_ARGS) { |
1114 | fprintf(stderr, _("%s: too many arguments\n"), | 1073 | bb_error_msg_and_die("too many arguments"); |
1115 | progname); | ||
1116 | exit(EXIT_ERROR); | ||
1117 | } | 1074 | } |
1118 | args[num_args++] = string_copy(arg); | 1075 | args[num_args++] = string_copy(arg); |
1119 | continue; | 1076 | continue; |
@@ -1135,7 +1092,7 @@ static void PRS(int argc, char *argv[]) | |||
1135 | progress_fd = 0; | 1092 | progress_fd = 0; |
1136 | else | 1093 | else |
1137 | goto next_arg; | 1094 | goto next_arg; |
1138 | } else if ((i+1) < argc && | 1095 | } else if ((i+1) < argc && |
1139 | !strncmp(argv[i+1], "-", 1) == 0) { | 1096 | !strncmp(argv[i+1], "-", 1) == 0) { |
1140 | progress_fd = string_to_int(argv[i]); | 1097 | progress_fd = string_to_int(argv[i]); |
1141 | if (progress_fd < 0) | 1098 | if (progress_fd < 0) |
@@ -1196,10 +1153,7 @@ static void PRS(int argc, char *argv[]) | |||
1196 | options[0] = '-'; | 1153 | options[0] = '-'; |
1197 | options[++opt] = '\0'; | 1154 | options[++opt] = '\0'; |
1198 | if (num_args >= MAX_ARGS) { | 1155 | if (num_args >= MAX_ARGS) { |
1199 | fprintf(stderr, | 1156 | bb_error_msg("too many arguments"); |
1200 | _("%s: too many arguments\n"), | ||
1201 | progname); | ||
1202 | exit(EXIT_ERROR); | ||
1203 | } | 1157 | } |
1204 | args[num_args++] = string_copy(options); | 1158 | args[num_args++] = string_copy(options); |
1205 | opt = 0; | 1159 | opt = 0; |
@@ -1222,12 +1176,6 @@ int fsck_main(int argc, char *argv[]) | |||
1222 | setvbuf(stdout, NULL, _IONBF, BUFSIZ); | 1176 | setvbuf(stdout, NULL, _IONBF, BUFSIZ); |
1223 | setvbuf(stderr, NULL, _IONBF, BUFSIZ); | 1177 | setvbuf(stderr, NULL, _IONBF, BUFSIZ); |
1224 | 1178 | ||
1225 | #ifdef ENABLE_NLS | ||
1226 | setlocale(LC_MESSAGES, ""); | ||
1227 | setlocale(LC_CTYPE, ""); | ||
1228 | bindtextdomain(NLS_CAT_NAME, LOCALEDIR); | ||
1229 | textdomain(NLS_CAT_NAME); | ||
1230 | #endif | ||
1231 | blkid_get_cache(&cache, NULL); | 1179 | blkid_get_cache(&cache, NULL); |
1232 | PRS(argc, argv); | 1180 | PRS(argc, argv); |
1233 | 1181 | ||
@@ -1241,19 +1189,11 @@ int fsck_main(int argc, char *argv[]) | |||
1241 | 1189 | ||
1242 | /* Update our search path to include uncommon directories. */ | 1190 | /* Update our search path to include uncommon directories. */ |
1243 | if (oldpath) { | 1191 | if (oldpath) { |
1244 | fsck_path = malloc (strlen (fsck_prefix_path) + 1 + | 1192 | bb_xasprintf(&fsck_path, "%s:%s", fsck_prefix_path, oldpath); |
1245 | strlen (oldpath) + 1); | ||
1246 | if (!fsck_path) { | ||
1247 | fprintf(stderr, "%s: Unable to allocate memory for fsck_path\n", progname); | ||
1248 | exit(EXIT_ERROR); | ||
1249 | } | ||
1250 | strcpy (fsck_path, fsck_prefix_path); | ||
1251 | strcat (fsck_path, ":"); | ||
1252 | strcat (fsck_path, oldpath); | ||
1253 | } else { | 1193 | } else { |
1254 | fsck_path = string_copy(fsck_prefix_path); | 1194 | fsck_path = string_copy(fsck_prefix_path); |
1255 | } | 1195 | } |
1256 | 1196 | ||
1257 | if ((num_devices == 1) || (serialize)) | 1197 | if ((num_devices == 1) || (serialize)) |
1258 | interactive = 1; | 1198 | interactive = 1; |
1259 | 1199 | ||
@@ -1291,12 +1231,13 @@ int fsck_main(int argc, char *argv[]) | |||
1291 | status |= inst->exit_status; | 1231 | status |= inst->exit_status; |
1292 | free_instance(inst); | 1232 | free_instance(inst); |
1293 | } | 1233 | } |
1294 | if (verbose > 1) | 1234 | if (verbose > 1) |
1295 | printf("----------------------------------\n"); | 1235 | printf("----------------------------------\n"); |
1296 | } | 1236 | } |
1297 | } | 1237 | } |
1298 | status |= wait_many(FLAG_WAIT_ALL); | 1238 | status |= wait_many(FLAG_WAIT_ALL); |
1299 | free(fsck_path); | 1239 | if (ENABLE_FEATURE_CLEAN_UP) |
1240 | free(fsck_path); | ||
1300 | blkid_put_cache(cache); | 1241 | blkid_put_cache(cache); |
1301 | return status; | 1242 | return status; |
1302 | } | 1243 | } |