]> Dogcows Code - chaz/tint2/blobdiff - src/util/common.c
*fix* 2 memleaks
[chaz/tint2] / src / util / common.c
index dd2f0113b94fceefd137b039f66c1176c6bc0a1b..8e213fcf8b72c5308ca93dcfc99ea9b1e6fe7cd9 100644 (file)
@@ -44,7 +44,9 @@ void copy_file(const char *pathSrc, const char *pathDest)
        fileDest = fopen(pathDest, "wb");
        if (fileDest == NULL) return;
 
-       while ((nb = fread(line, 1, 100, fileSrc)) > 0) fwrite(line, 1, nb, fileDest);
+       while ((nb = fread(line, 1, 100, fileSrc)) > 0)
+               if ( nb != fwrite(line, 1, nb, fileDest))
+                       printf("Error while copying file %s to %s\n", pathSrc, pathDest);
 
        fclose (fileDest);
        fclose (fileSrc);
This page took 0.02405 seconds and 4 git commands to generate.