Author: marcel
Date: Wed May 21 17:38:14 2014
New Revision: 266512
URL: http://svnweb.freebsd.org/changeset/base/266512

Log:
  Fix CID 1215124: Handle errors properly.

Modified:
  head/usr.bin/mkimg/image.c

Modified: head/usr.bin/mkimg/image.c
==============================================================================
--- head/usr.bin/mkimg/image.c  Wed May 21 17:37:22 2014        (r266511)
+++ head/usr.bin/mkimg/image.c  Wed May 21 17:38:14 2014        (r266512)
@@ -119,8 +119,12 @@ image_copyout(int fd)
                }
        }
        free(buffer);
+       if (error)
+               return (error);
        ofs = lseek(fd, 0L, SEEK_CUR);
-       ftruncate(fd, ofs);
+       if (ofs == -1)
+               return (errno);
+       error = (ftruncate(fd, ofs) == -1) ? errno : 0;
        return (error);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to