diff options
| author | Quentin Young <qlyoung@users.noreply.github.com> | 2018-06-22 14:11:09 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-22 14:11:09 -0400 |
| commit | 5caa3ad34fb8cf59d1b14b31547d24f1801b8289 (patch) | |
| tree | b34f8790ee8f9ab5495fd5a26128dbb7e2c49be6 | |
| parent | ec446a4673631437823065eb47672549e3be9766 (diff) | |
| parent | 1a40fad5688f1582371627089a23e697ac3b68f3 (diff) | |
Merge pull request #2512 from pacovn/Coverity_1399200_Unchecked_return_value_from_library
vtysh: return value check (Coverity 1399200)
| -rw-r--r-- | vtysh/vtysh.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 0c3d84f38f..66b49800dd 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2635,8 +2635,13 @@ static void backup_config_file(const char *fbackup) strcat(integrate_sav, CONF_BACKUP_EXT); /* Move current configuration file to backup config file. */ - unlink(integrate_sav); - rename(fbackup, integrate_sav); + if (unlink(integrate_sav) != 0) { + vty_out(vty, "Warning: %s unlink failed\n", integrate_sav); + } + if (rename(fbackup, integrate_sav) != 0) { + vty_out(vty, "Error renaming %s to %s\n", fbackup, + integrate_sav); + } free(integrate_sav); } |
