The exit code 1 refers to general error and using -1 wraps to
255, both codes do not signify bad arguments. Let's use exit code 129
(EXIT_BADARGS) for hinting to the users about invalid usage.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
break;
default:
usage(1, argv[0]);
- return -1;
+ exit(EXIT_BADARGS);
}
}
/* load the blacklist from the default location */
ret = load_list(BLACKLIST_CONF, &black_list);
}
- if (ret != 0)
+ if (ret != 0) {
+ ret = EXIT_BADARGS;
goto finish;
+ }
/* whitelist */
if (flags & FL_WHITE)
ret = load_list(wl_file, &white_list);
- if (ret != 0)
+ if (ret != 0) {
+ ret = EXIT_BADARGS;
goto finish;
+ }
/* print the header */
fprintf(output_f, "# Configuration file generated by cgsnapshot\n");
/* print mount points section */
ret = parse_mountpoints(wanted_cont, argv[0]);
+ ret = ret ? EXIT_BADARGS : 0;
/* continue with processing on error*/
/* print hierarchies section */