aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/diff
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-11 20:57:00 +0000
committerrsc <devnull@localhost>2005-01-11 20:57:00 +0000
commit1c096fa40aa3a74e0886b62f8686f294968a1130 (patch)
tree65bd7a353d1b621873af045ba47363180ce9f3d2 /src/cmd/diff
parent8f3ba4782d3c6bd6711e247feb20ac6c7c808003 (diff)
downloadplan9port-1c096fa40aa3a74e0886b62f8686f294968a1130.tar.gz
plan9port-1c096fa40aa3a74e0886b62f8686f294968a1130.tar.bz2
plan9port-1c096fa40aa3a74e0886b62f8686f294968a1130.zip
better cleanup of tmp files
Diffstat (limited to 'src/cmd/diff')
-rw-r--r--src/cmd/diff/main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cmd/diff/main.c b/src/cmd/diff/main.c
index 00f69a3e..ab114d4d 100644
--- a/src/cmd/diff/main.c
+++ b/src/cmd/diff/main.c
@@ -138,10 +138,10 @@ diff(char *f, char *t, int level)
Dir *fsb, *tsb;
if ((fp = statfile(f, &fsb)) == 0)
- return;
+ goto Return;
if ((tp = statfile(t, &tsb)) == 0){
free(fsb);
- return;
+ goto Return;
}
if (DIRECTORY(fsb) && DIRECTORY(tsb)) {
if (rflag || level == 0)
@@ -172,6 +172,9 @@ diff(char *f, char *t, int level)
}
free(fsb);
free(tsb);
+
+Return:
+ rmtmpfiles();
}
void
@@ -186,7 +189,7 @@ main(int argc, char *argv[])
while (--argc && (*++argv)[0] == '-' && (*argv)[1]) {
for (p = *argv+1; *p; p++) {
switch (*p) {
-
+ case 'c':
case 'e':
case 'f':
case 'n':
@@ -233,10 +236,9 @@ main(int argc, char *argv[])
free(fsb);
}
free(tsb);
- for (i = 0; i < argc-1; i++) {
+ for (i = 0; i < argc-1; i++)
diff(argv[i], argv[argc-1], 0);
- rmtmpfiles();
- }
+
done(anychange);
/*NOTREACHED*/
}