From 58a924fd50e96c827fc6dd3dcea48328b6abe4be Mon Sep 17 00:00:00 2001 From: Mike Meffie Date: Tue, 3 Feb 2009 19:44:27 +0000 Subject: [PATCH] upclient-cleanup-temp-files-20090203 LICENSE IPL10 FIXES 124221 remove tempfiles in the event of a fetching error --- src/update/client.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } -- 2.39.5