From: Mike Meffie Date: Tue, 3 Feb 2009 19:44:39 +0000 (+0000) Subject: DEVEL15-upclient-cleanup-temp-files-20090203 X-Git-Tag: openafs-devel-1_5_58~156 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=073fb89d2ca186e259c30fde557c3871b5cc6ef5;p=packages%2Fo%2Fopenafs.git DEVEL15-upclient-cleanup-temp-files-20090203 LICENSE IPL10 FIXES 124221 remove tempfiles in the event of a fetching error (cherry picked from commit 58a924fd50e96c827fc6dd3dcea48328b6abe4be) --- diff --git a/src/update/client.c b/src/update/client.c index d88eb2eb3..583c781f2 100644 --- a/src/update/client.c +++ b/src/update/client.c @@ -449,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)) @@ -676,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; } @@ -686,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 @@ -713,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; }