upclient-cleanup-temp-files-20090203
[openafs.git] / src / update / client.c
index b176aac..583c781 100644 (file)
@@ -36,13 +36,7 @@ RCSID
 #include <sys/time.h>
 #include <dirent.h>
 #endif
-#ifdef HAVE_STRING_H
 #include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -455,7 +449,7 @@ FetchFile(struct rx_call *call, char *remoteFile, char *localFile, int dirFlag)
     if (fstat(fd, &status) < 0) {
        afs_com_err(whoami, errno, "Could not stat %s", localFile);
        close(fd);
-       printf("could not stast %s\n", localFile);
+       printf("could not stat %s\n", localFile);
        return UPDATE_ERROR;
     }
     if (update_ReceiveFile(fd, call, &status))
@@ -682,6 +676,7 @@ GetFileFromUpServer(struct rx_connection *conn,     /* handle for upserver */
     if (errcode) {
        printf("failed to fetch file %s \n", filename);
        afs_com_err(whoami, errcode, "fetching file");
+        unlink(newfile);
        return 1;
     }
 
@@ -692,6 +687,7 @@ GetFileFromUpServer(struct rx_connection *conn,     /* handle for upserver */
               (unsigned int)mode);
        afs_com_err(whoami, errno, "could not change protection on %s to %u",
                newfile, mode);
+        unlink(newfile);
        return 1;
     }
 #ifdef AFS_NT40_ENV
@@ -719,6 +715,7 @@ GetFileFromUpServer(struct rx_connection *conn,     /* handle for upserver */
        afs_com_err(whoami, errno,
                "could not change access and modify times on %s to %u %u",
                newfile, atime, mtime);
+        unlink(newfile);
        return 1;
     }