Checking the return value of fcntl(F_SETFL O_NONBLOCK). Coverity CID 12536.
This commit is contained in:
parent
49dd9dc993
commit
e8b94e7b50
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 - 2011 Thomas Schmitt
|
* Copyright (c) 2009 - 2015 Thomas Schmitt
|
||||||
*
|
*
|
||||||
* This file is part of the libisofs project; you can redistribute it and/or
|
* This file is part of the libisofs project; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License version 2
|
* modify it under the terms of the GNU General Public License version 2
|
||||||
@ -243,25 +243,34 @@ int extf_stream_open_flag(IsoStream *stream, int flag)
|
|||||||
ret= ISO_FILE_READ_ERROR;
|
ret= ISO_FILE_READ_ERROR;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
/* Dispose pipes and child */
|
goto dispose_pipe_and_child;
|
||||||
extf_stream_close_flag(stream, 1);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
stream_open = 1;
|
stream_open = 1;
|
||||||
/* Make filter outlet non-blocking */
|
/* Make filter outlet non-blocking */
|
||||||
ret = fcntl(recv_pipe[0], F_GETFL);
|
ret = fcntl(recv_pipe[0], F_GETFL);
|
||||||
if (ret != -1) {
|
if (ret != -1) {
|
||||||
ret |= O_NONBLOCK;
|
ret |= O_NONBLOCK;
|
||||||
fcntl(recv_pipe[0], F_SETFL, ret);
|
ret = fcntl(recv_pipe[0], F_SETFL, ret);
|
||||||
|
if (ret == -1) {
|
||||||
|
ret = ISO_FILE_ERROR;
|
||||||
|
goto dispose_pipe_and_child;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Make filter sink non-blocking */
|
/* Make filter sink non-blocking */
|
||||||
ret = fcntl(send_pipe[1], F_GETFL);
|
ret = fcntl(send_pipe[1], F_GETFL);
|
||||||
if (ret != -1) {
|
if (ret != -1) {
|
||||||
ret |= O_NONBLOCK;
|
ret |= O_NONBLOCK;
|
||||||
fcntl(send_pipe[1], F_SETFL, ret);
|
ret = fcntl(send_pipe[1], F_SETFL, ret);
|
||||||
|
if (ret == -1) {
|
||||||
|
ret = ISO_FILE_ERROR;
|
||||||
|
goto dispose_pipe_and_child;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
dispose_pipe_and_child:;
|
||||||
|
extf_stream_close_flag(stream, 1);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* child */
|
/* child */
|
||||||
|
Loading…
Reference in New Issue
Block a user