tree-wide: use -EBADF more
This commit is contained in:
+3
-3
@@ -22,8 +22,8 @@ int safe_close(int fd);
|
||||
void safe_close_pair(int p[static 2]);
|
||||
|
||||
static inline int safe_close_above_stdio(int fd) {
|
||||
if (fd < 3) /* Don't close stdin/stdout/stderr, but still invalidate the fd by returning -1 */
|
||||
return -1;
|
||||
if (fd < 3) /* Don't close stdin/stdout/stderr, but still invalidate the fd by returning -EBADF. */
|
||||
return -EBADF;
|
||||
|
||||
return safe_close(fd);
|
||||
}
|
||||
@@ -87,7 +87,7 @@ int fd_move_above_stdio(int fd);
|
||||
int rearrange_stdio(int original_input_fd, int original_output_fd, int original_error_fd);
|
||||
|
||||
static inline int make_null_stdio(void) {
|
||||
return rearrange_stdio(-1, -1, -1);
|
||||
return rearrange_stdio(-EBADF, -EBADF, -EBADF);
|
||||
}
|
||||
|
||||
/* Like TAKE_PTR() but for file descriptors, resetting them to -1 */
|
||||
|
||||
Reference in New Issue
Block a user