V_pref(vp, nearInode);
while (tag == D_VNODE) {
int haveStuff = 0;
+ int saw_f = 0;
memset(buf, 0, sizeof(buf));
if (!ReadInt32(iodp, (afs_uint32 *) & vnodeNumber))
break;
Error error;
afs_fsize_t vnodeLength;
+ if (saw_f) {
+ Log("Volser: ReadVnodes: warning: ignoring duplicate "
+ "file entries for vnode %lu in dump\n",
+ (unsigned long)vnodeNumber);
+ volser_WriteFile(vnodeNumber, iodp, NULL, tag, &error);
+ break;
+ }
+ saw_f = 1;
+
ino =
IH_CREATE(V_linkHandle(vp), V_device(vp),
VPartitionPath(V_partition(vp)), nearInode,
/* called with disk file only. Note that we don't have to worry about rx_Read
* needing to read an ungetc'd character, since the ReadInt32 will have read
* it instead.
+ *
+ * if handleP == NULL, don't write the file anywhere; just read and discard
+ * the file contents
*/
static afs_fsize_t
volser_WriteFile(int vn, struct iod *iodp, FdHandle_t * handleP, int tag,
*status = 3;
break;
}
- nBytes = FDH_WRITE(handleP, p, size);
- if (nBytes > 0)
- written += nBytes;
- if (nBytes != size) {
- Log("1 Volser: WriteFile: Error writing (%u) bytes to vnode %d: %s; restore aborted\n", (int)(nBytes & 0xffffffff), vn, afs_error_message(errno));
- *status = 4;
- break;
+ if (handleP) {
+ nBytes = FDH_WRITE(handleP, p, size);
+ if (nBytes > 0)
+ written += nBytes;
+ if (nBytes != size) {
+ Log("1 Volser: WriteFile: Error writing (%u) bytes to vnode %d; %s; restore aborted\n", (int)(nBytes & 0xffffffff), vn, afs_error_message(errno));
+ *status = 4;
+ break;
+ }
}
}
free(p);