From: Masahiro Yamada Date: Sun, 24 Apr 2022 19:07:46 +0000 (+0900) Subject: modpost: do not write out any file when error occurred X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c155a47d83ab0b5ee96ebe1721057cba1936d0d5;p=linux.git modpost: do not write out any file when error occurred If an error occurs, modpost will fail anyway. Do not write out any content (, which might be invalid). Signed-off-by: Masahiro Yamada Reviewed-by: Nick Desaulniers --- diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 141370ebbfd34..f0d48f65fb33f 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -2333,6 +2333,9 @@ static void write_buf(struct buffer *b, const char *fname) { FILE *file; + if (error_occurred) + return; + file = fopen(fname, "w"); if (!file) { perror(fname);