From: Arnout Vandecappelle Date: Mon, 3 Jul 2017 21:00:48 +0000 (+0200) Subject: makedevs: support optional files X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bdbbc72934bc781cff7306da3c5233d21022bc33;p=buildroot.git makedevs: support optional files Add the 'F' file type to makedevs, that allows a file to be optional. With this option, the line is just silently skipped if the file doesn't exist (or is not a regular file). This is useful for _PERMISSIONS where the file can be configured out by package-specific configuration that is not directly handled by Buildroot, like busybox. Cc: Clayton Shotwell Cc: Matthew Weber Cc: Niranjan Reddy Cc: Bryce Ferguson Signed-off-by: Arnout Vandecappelle (Essensium/Mind) Signed-off-by: Thomas Petazzoni --- diff --git a/package/makedevs/makedevs.c b/package/makedevs/makedevs.c index 7092b1475e..1ba5936342 100644 --- a/package/makedevs/makedevs.c +++ b/package/makedevs/makedevs.c @@ -570,9 +570,12 @@ int main(int argc, char **argv) ret = EXIT_FAILURE; goto loop; } - } else if (type == 'f') { + } else if (type == 'f' || type == 'F') { struct stat st; if ((stat(full_name, &st) < 0 || !S_ISREG(st.st_mode))) { + if (type == 'F') { + continue; /*Ignore optional files*/ + } bb_perror_msg("line %d: regular file '%s' does not exist", linenum, full_name); ret = EXIT_FAILURE; goto loop;