Diffstat (limited to 'noncore/settings/networksettings/ppp/modem.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/modem.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp index 7b2e2a3..17ada9b 100644 --- a/noncore/settings/networksettings/ppp/modem.cpp +++ b/noncore/settings/networksettings/ppp/modem.cpp | |||
@@ -759,26 +759,28 @@ bool Modem::createAuthFile(Auth method, const char *username, const char *passwo | |||
759 | // restore umask | 759 | // restore umask |
760 | umask(old_umask); | 760 | umask(old_umask); |
761 | 761 | ||
762 | // free memory allocated by regcomp | 762 | // free memory allocated by regcomp |
763 | regfree(&preg); | 763 | regfree(&preg); |
764 | 764 | ||
765 | if(!(oldName = authFile(method, Old))) | 765 | if(!(oldName = authFile(method, Old))) |
766 | return false; | 766 | return false; |
767 | 767 | ||
768 | // delete old file if any | 768 | // delete old file if any |
769 | unlink(oldName); | 769 | unlink(oldName); |
770 | 770 | ||
771 | rename(authfile, oldName); | 771 | if (rename(authfile, oldName) == -1) |
772 | rename(newName, authfile); | 772 | return false; |
773 | if (rename(newName, authfile) == -1) | ||
774 | return false; | ||
773 | 775 | ||
774 | return true; | 776 | return true; |
775 | } | 777 | } |
776 | 778 | ||
777 | 779 | ||
778 | bool Modem::removeAuthFile(Auth method) { | 780 | bool Modem::removeAuthFile(Auth method) { |
779 | const char *authfile, *oldName; | 781 | const char *authfile, *oldName; |
780 | 782 | ||
781 | if(!(authfile = authFile(method))) | 783 | if(!(authfile = authFile(method))) |
782 | return false; | 784 | return false; |
783 | if(!(oldName = authFile(method, Old))) | 785 | if(!(oldName = authFile(method, Old))) |
784 | return false; | 786 | return false; |