From b21fa18aeccf5b6a23c885eb3fa804a94d14b5b5 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 22 Feb 1996 15:46:54 +0000 Subject: [PATCH] don't just exit on error, clean up and return CVS patchset: 395 CVS date: 1996/02/22 15:46:54 --- build/pack.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/build/pack.c b/build/pack.c index 1f3dcbb..b679020 100644 --- a/build/pack.c +++ b/build/pack.c @@ -123,11 +123,19 @@ int generateRPM(char *name, /* name-version-release */ while ((count = read(ifd, buffer, sizeof(buffer))) > 0) { if (count == -1) { perror("Couldn't read archiveTemp"); - exit(1); + close(fd); + close(ifd); + unlink(archiveTemp); + unlink(sigtarget); + return 1; } if (write(fd, buffer, count) < 0) { perror("Couldn't write package to temp file"); - exit(1); + close(fd); + close(ifd); + unlink(archiveTemp); + unlink(sigtarget); + return 1; } } close(ifd); @@ -158,11 +166,19 @@ int generateRPM(char *name, /* name-version-release */ while ((count = read(ifd, buffer, sizeof(buffer))) > 0) { if (count == -1) { perror("Couldn't read sigtarget"); - exit(1); + close(ifd); + close(fd); + unlink(sigtarget); + unlink(filename); + return 1; } if (write(fd, buffer, count) < 0) { perror("Couldn't write package"); - exit(1); + close(ifd); + close(fd); + unlink(sigtarget); + unlink(filename); + return 1; } } close(ifd); -- 2.7.4