[PATCH] D118439: [scan-build] Fix deadlock at failures in libears/ear.c
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 2 03:56:38 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd919d027ba2a: [scan-build] Fix deadlock at failures in libears/ear.c (authored by steakhal).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118439/new/
https://reviews.llvm.org/D118439
Files:
clang/tools/scan-build-py/lib/libear/ear.c
Index: clang/tools/scan-build-py/lib/libear/ear.c
===================================================================
--- clang/tools/scan-build-py/lib/libear/ear.c
+++ clang/tools/scan-build-py/lib/libear/ear.c
@@ -411,6 +411,7 @@
const char *cwd = getcwd(NULL, 0);
if (0 == cwd) {
perror("bear: getcwd");
+ pthread_mutex_unlock(&mutex);
exit(EXIT_FAILURE);
}
char const *const out_dir = initial_env[0];
@@ -419,11 +420,13 @@
if (-1 ==
snprintf(filename, path_max_length, "%s/%d.cmd", out_dir, getpid())) {
perror("bear: snprintf");
+ pthread_mutex_unlock(&mutex);
exit(EXIT_FAILURE);
}
FILE *fd = fopen(filename, "a+");
if (0 == fd) {
perror("bear: fopen");
+ pthread_mutex_unlock(&mutex);
exit(EXIT_FAILURE);
}
fprintf(fd, "%d%c", getpid(), RS);
@@ -437,6 +440,7 @@
fprintf(fd, "%c", GS);
if (fclose(fd)) {
perror("bear: fclose");
+ pthread_mutex_unlock(&mutex);
exit(EXIT_FAILURE);
}
free((void *)cwd);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118439.405207.patch
Type: text/x-patch
Size: 1008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220202/7884769e/attachment.bin>
More information about the cfe-commits
mailing list