diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2022-04-25 04:07:46 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2022-05-08 03:16:59 +0900 |
commit | c155a47d83ab0b5ee96ebe1721057cba1936d0d5 (patch) | |
tree | 663b91dff82e2411306945ca145f68b8c732d846 /scripts | |
parent | 15a28c7c72917f96820e9e9ccd113606363ba3ac (diff) |
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 <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mod/modpost.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 141370ebbfd3..f0d48f65fb33 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); |