X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=tape-src%2Ftapetype.c;h=dd4758187b91b398b3cb48265c3bc71dcefbe222;hb=eefb15c5c04acb3c75f0c704ea664feb1bbae75c;hp=50340ad850c4882daaef000c3acd5894c79cb96c;hpb=bde83ad58d800ae004caccab6531234272181da2;p=debian%2Famanda diff --git a/tape-src/tapetype.c b/tape-src/tapetype.c index 50340ad..dd47581 100644 --- a/tape-src/tapetype.c +++ b/tape-src/tapetype.c @@ -25,7 +25,7 @@ * University of Maryland at College Park */ /* - * $Id: tapetype.c,v 1.3.2.3.4.3.2.9.2.3 2005/10/02 13:48:42 martinea Exp $ + * $Id: tapetype.c,v 1.24 2006/03/10 11:56:06 martinea Exp $ * * tests a tape in a given tape unit and prints a tapetype entry for * it. */ @@ -45,6 +45,7 @@ static int blockkb = 32; static int blocksize; static char *randombytes = (char *) NULL; +static char *prandombytes = (char *) NULL; #if USE_RAND /* If the C library does not define random(), try to use rand() by @@ -74,6 +75,7 @@ static void allocrandombytes() { } else { randombytes = p; /* alloc already on boundary */ } + prandombytes = p; } } @@ -322,6 +324,9 @@ int main(argc, argv) sProgName++; } + /* Don't die when child closes pipe */ + signal(SIGPIPE, SIG_IGN); + estsize = 1024 * 1024; /* assume 1 GByte for now */ tapedev = getenv("TAPE"); typename = "unknown-tapetype"; @@ -599,14 +604,17 @@ int main(argc, argv) if (tapefd_rewind(fd) == -1) { fprintf(stderr, "%s: could not rewind %s: %s\n", sProgName, tapedev, strerror(errno)); + free(randombytes); return 1; } if (tapefd_close(fd) == -1) { fprintf(stderr, "%s: could not close %s: %s\n", sProgName, tapedev, strerror(errno)); + free(randombytes); return 1; } + free(randombytes); return 0; }