author | erik <erik> | 2007-01-31 22:06:07 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-31 22:06:07 (UTC) |
commit | 9395cf2a65184e493714c699bb23b02ea31feef5 (patch) (unidiff) | |
tree | ea07c026298820559c13ad32e612d51048cee0a9 /noncore/settings/networksettings/ppp | |
parent | 958e042c5a4d4e38fd1baae50b78a2febfd306ab (diff) | |
download | opie-9395cf2a65184e493714c699bb23b02ea31feef5.zip opie-9395cf2a65184e493714c699bb23b02ea31feef5.tar.gz opie-9395cf2a65184e493714c699bb23b02ea31feef5.tar.bz2 |
I expanded my audit to include any app I could get to compile in i386.
In that expansion a whole new crop of unchecked returns has sprung up.
This commit fixes those weeds or should I say potential bugs.
Diffstat (limited to 'noncore/settings/networksettings/ppp') (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 | |||
@@ -747,50 +747,52 @@ bool Modem::createAuthFile(Auth method, const char *username, const char *passwo | |||
747 | if(regexec(&preg, line, 0, 0L, 0) == 0) | 747 | if(regexec(&preg, line, 0, 0L, 0) == 0) |
748 | continue; | 748 | continue; |
749 | fputs(line, fout); | 749 | fputs(line, fout); |
750 | } | 750 | } |
751 | fclose(fin); | 751 | fclose(fin); |
752 | } | 752 | } |
753 | 753 | ||
754 | // append user/pass pair | 754 | // append user/pass pair |
755 | fprintf(fout, "\"%s\"\t*\t\"%s\"\n", username, password); | 755 | fprintf(fout, "\"%s\"\t*\t\"%s\"\n", username, password); |
756 | fclose(fout); | 756 | fclose(fout); |
757 | } | 757 | } |
758 | 758 | ||
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; |
785 | 787 | ||
786 | if(access(oldName, F_OK) == 0) { | 788 | if(access(oldName, F_OK) == 0) { |
787 | unlink(authfile); | 789 | unlink(authfile); |
788 | return (rename(oldName, authfile) == 0); | 790 | return (rename(oldName, authfile) == 0); |
789 | } else | 791 | } else |
790 | return false; | 792 | return false; |
791 | } | 793 | } |
792 | 794 | ||
793 | 795 | ||
794 | bool Modem::setSecret(int method, const char* name, const char* password) | 796 | bool Modem::setSecret(int method, const char* name, const char* password) |
795 | { | 797 | { |
796 | 798 | ||