[Toybox] Scan-build error

Cynt Rynt cynt1728 at gmail.com
Tue Nov 11 11:05:55 PST 2014


Hi,
Ran scan-build on toybox and found some errors.  This fix removed an error
in password.c, but I'm not sure if it's the right fix.
Thanks,
Cindy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20141111/80f38c1f/attachment-0002.htm>
-------------- next part --------------
diff -r 2997847aa299 lib/password.c
--- a/lib/password.c	Mon Nov 10 17:17:17 2014 -0600
+++ b/lib/password.c	Tue Nov 11 11:04:05 2014 -0800
@@ -8,7 +8,7 @@
 
 // generate appropriate random salt string for given encryption algorithm.
 int get_salt(char *salt, char *algo)
-{      
+{
   struct {
     char *type, id, len;
   } al[] = {{"des", 0, 2}, {"md5", 1, 8}, {"sha256", 5, 16}, {"sha512", 6, 16}};
@@ -157,6 +157,7 @@
 
   *sfx = '-';
   ret = unlink(filenamesfx);
+  if (ret < 0) error_msg("can't unlink file");
   ret = link(filename, filenamesfx);
   if (ret < 0) error_msg("can't create backup file");
 


More information about the Toybox mailing list