From: Mike Meffie Date: Tue, 3 Feb 2009 19:44:51 +0000 (+0000) Subject: STABLE14-upclient-cleanup-temp-files-20090203 X-Git-Tag: openafs-stable-1_4_9pre1~51 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=24d29f702dc818892d8fdd188d150ce3b91735f1;p=packages%2Fo%2Fopenafs.git STABLE14-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; }