mirror of
https://git.openafs.org/openafs.git
synced 2025-01-21 00:10:15 +00:00
volinfo: show header filenames even if error
When invoked with -header option, print the header inode number, and namei filename, even if the header file cannot be opened. Change-Id: Id2a2e63f07e12cd817718a9da63d24250718ae06 Reviewed-on: http://gerrit.openafs.org/7190 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Tom Keiser <tkeiser@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
2460e132a9
commit
b71f4ffa7c
@ -1172,7 +1172,7 @@ HandleSpecialFile(const char *name, struct DiskPartition64 *dp,
|
||||
struct VolumeHeader *header, Inode inode,
|
||||
afs_sfsize_t * psize)
|
||||
{
|
||||
afs_sfsize_t size = 0;
|
||||
afs_sfsize_t size = -1;
|
||||
IHandle_t *ih = NULL;
|
||||
FdHandle_t *fdP = NULL;
|
||||
#ifdef AFS_NAMEI_ENV
|
||||
@ -1183,7 +1183,7 @@ HandleSpecialFile(const char *name, struct DiskPartition64 *dp,
|
||||
fdP = IH_OPEN(ih);
|
||||
if (fdP == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: Error opening header file '%s' for volume %u", progname,
|
||||
"%s: Error opening header file '%s' for volume %u\n", progname,
|
||||
name, header->id);
|
||||
perror("open");
|
||||
goto error;
|
||||
@ -1191,22 +1191,27 @@ HandleSpecialFile(const char *name, struct DiskPartition64 *dp,
|
||||
size = FDH_SIZE(fdP);
|
||||
if (size == -1) {
|
||||
fprintf(stderr,
|
||||
"%s: Error getting size of header file '%s' for volume %u",
|
||||
"%s: Error getting size of header file '%s' for volume %u\n",
|
||||
progname, name, header->id);
|
||||
perror("fstat");
|
||||
goto error;
|
||||
}
|
||||
*psize += size;
|
||||
|
||||
error:
|
||||
if (DumpInfo) {
|
||||
printf("\t%s inode\t= %s (size = %lld)\n",
|
||||
name, PrintInode(NULL, inode), size);
|
||||
printf("\t%s inode\t= %s (size = ", name, PrintInode(NULL, inode));
|
||||
if (size != -1) {
|
||||
printf("%lld)\n", size);
|
||||
} else {
|
||||
printf("unknown)\n");
|
||||
}
|
||||
#ifdef AFS_NAMEI_ENV
|
||||
namei_HandleToName(&filename, ih);
|
||||
printf("\t%s namei\t= %s\n", name, filename.n_path);
|
||||
#endif /* AFS_NAMEI_ENV */
|
||||
}
|
||||
*psize += size;
|
||||
|
||||
error:
|
||||
if (fdP != NULL) {
|
||||
FDH_REALLYCLOSE(fdP);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user