projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b4f5e72
)
client: check return of dup(2)
author
Jens Axboe
<axboe@kernel.dk>
Fri, 15 Jun 2018 15:10:48 +0000
(09:10 -0600)
committer
Jens Axboe
<axboe@kernel.dk>
Fri, 15 Jun 2018 15:10:48 +0000
(09:10 -0600)
If dup(2) fails, we can't pass it to fdopen.
Fixes:
b4f5e72f1383
("client: parse env variables before sending job-file contents to server")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
client.c
patch
|
blob
|
blame
|
history
diff --git
a/client.c
b/client.c
index 60f7c6ab82767cab31cf30443e07affa15c32b51..611ee2f5a3f929d9d7ae7c7d14c229196bdfedbb 100644
(file)
--- a/
client.c
+++ b/
client.c
@@
-123,8
+123,13
@@
static int read_ini_data(int fd, void *data, size_t size)
char *p = data;
int ret = 0;
FILE *fp;
char *p = data;
int ret = 0;
FILE *fp;
+ int dupfd;
- fp = fdopen(dup(fd), "r");
+ dupfd = dup(fd);
+ if (dupfd < 0)
+ return errno;
+
+ fp = fdopen(dupfd, "r");
if (!fp)
return errno;
if (!fp)
return errno;