diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2017-02-10 15:04:06 +0100 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2017-02-10 15:04:06 +0100 |
| commit | 148781210fbcb1b26d5df678a400fa5dd8549e42 (patch) | |
| tree | 78d57b0b68c54d029e47fdc834aacb0bc3815715 /lib/command.c | |
| parent | 01024b5235fb574b7a712d1363bc14df7cd1ad7e (diff) | |
lib: fix remaining coverity issues
Reported-by: Coverity
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command.c')
| -rw-r--r-- | lib/command.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/command.c b/lib/command.c index 4a84386858..d1e11f0617 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1450,7 +1450,8 @@ DEFUN (config_write, VTY_NEWLINE); goto finished; } - fsync (dirfd); + if (dirfd >= 0) + fsync (dirfd); } if (rename (config_file_tmp, config_file) != 0) { @@ -1458,7 +1459,8 @@ DEFUN (config_write, VTY_NEWLINE); goto finished; } - fsync (dirfd); + if (dirfd >= 0) + fsync (dirfd); vty_out (vty, "Configuration saved to %s%s", config_file, VTY_NEWLINE); @@ -1467,7 +1469,8 @@ DEFUN (config_write, finished: if (ret != CMD_SUCCESS) unlink (config_file_tmp); - close (dirfd); + if (dirfd >= 0) + close (dirfd); XFREE (MTYPE_TMP, config_file_tmp); XFREE (MTYPE_TMP, config_file_sav); return ret; |
