Running salvageserver with the -client and -showlog options will
currently segfault, since -client does not open logFile, and -showlog
will attempt to rewind logFile on exit.
Fix this by not allowing -client and -showlog together (since it won't
work anyway, as -showlog tries to read SalvageLog), and by making
showlog() check logFile for NULL-ness.
Change-Id: I30f43ef1696f1e7e8873b9e1cc3867b4e06d1980
Reviewed-on: http://gerrit.openafs.org/734
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
vid = atoi(ti->data);
}
+ if (ShowLog) {
+ printf("-showlog does not work with -client\n");
+ exit(-1);
+ }
+
if (!seenpart || !seenvol) {
printf("You must specify '-partition' and '-volumeid' with the '-client' option\n");
exit(-1);
}
#endif
- rewind(logFile);
- fclose(logFile);
+ if (logFile) {
+ rewind(logFile);
+ fclose(logFile);
+ }
logFile = afs_fopen(AFSDIR_SERVER_SLVGLOG_FILEPATH, "r");