Blame SOURCES/0004-Check-whether-a-file-was-created-when-doing-mkstemp-.patch
|
|
28453c |
From 2187471296c9a1ac0fb8cc08157949a637ad96c8 Mon Sep 17 00:00:00 2001
|
|
|
28453c |
From: Jan Zeleny <jzeleny@redhat.com>
|
|
|
28453c |
Date: Wed, 8 Jan 2014 09:23:46 +0100
|
|
|
28453c |
Subject: [PATCH 4/4] Check whether a file was created when doing mkstemp
|
|
|
28453c |
(#1032666)
|
|
|
28453c |
|
|
|
28453c |
---
|
|
|
28453c |
scl.c | 8 ++++++++
|
|
|
28453c |
1 file changed, 8 insertions(+)
|
|
|
28453c |
|
|
|
28453c |
diff --git a/scl.c b/scl.c
|
|
|
28453c |
index cf3ff5bfa7fce0b95705b0aa09946524d06801c5..fcdebcbfd35dec2c4ff68536bc90771d439fc044 100644
|
|
|
28453c |
--- a/scl.c
|
|
|
28453c |
+++ b/scl.c
|
|
|
28453c |
@@ -105,6 +105,10 @@ static char **read_script_output( char *ori_cmd ) {
|
|
|
28453c |
FILE *f;
|
|
|
28453c |
|
|
|
28453c |
tfd = mkstemp(tmp);
|
|
|
28453c |
+ if (tfd < 0) {
|
|
|
28453c |
+ fprintf(stderr, "Cannot create a temporary file: %s\n", tmp);
|
|
|
28453c |
+ exit(EXIT_FAILURE);
|
|
|
28453c |
+ }
|
|
|
28453c |
check_asprintf(&cmd, "%s > %s", ori_cmd, tmp);
|
|
|
28453c |
i = system(cmd);
|
|
|
28453c |
free(cmd);
|
|
|
28453c |
@@ -350,6 +354,10 @@ int main(int argc, char **argv) {
|
|
|
28453c |
}
|
|
|
28453c |
|
|
|
28453c |
tfd = mkstemp(tmp);
|
|
|
28453c |
+ if (tfd < 0) {
|
|
|
28453c |
+ fprintf(stderr, "Cannot create a temporary file: %s\n", tmp);
|
|
|
28453c |
+ exit(EXIT_FAILURE);
|
|
|
28453c |
+ }
|
|
|
28453c |
|
|
|
28453c |
check_asprintf(&enabled, "eval \"SCLS=( ${X_SCLS[*]} )\"\n");
|
|
|
28453c |
write_script(tfd, enabled);
|
|
|
28453c |
--
|
|
|
28453c |
1.8.3.1
|
|
|
28453c |
|