diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-02-10 11:06:37 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-10 11:06:37 -0500 |
| commit | c19cf154ef469b1242af3edde06260253b2fca14 (patch) | |
| tree | 657d1d89b453d16b3ce3151cf2d48bd71eb6db40 /lib/command.c | |
| parent | 01024b5235fb574b7a712d1363bc14df7cd1ad7e (diff) | |
| parent | 6de469061b9933be7afaf2712cb45cb13c51a90c (diff) | |
Merge pull request #194 from opensourcerouting/coverity-lib-2
more lib/ coverity fixes
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; |
