From owner-freebsd-hackers Sun Mar 17 14:44:13 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id OAA11393 for hackers-outgoing; Sun, 17 Mar 1996 14:44:13 -0800 (PST) Received: from dorothy.columbiasc.attgis.com ([153.78.113.10]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id OAA11360 for ; Sun, 17 Mar 1996 14:43:58 -0800 (PST) Received: (from haug@localhost) by dorothy.columbiasc.attgis.com (8.6.12/8.6.12) id MAA03032; Sun, 17 Mar 1996 12:38:00 -0500 From: "Brian R. Haug" Message-Id: <199603171738.MAA03032@dorothy.columbiasc.attgis.com> Subject: changes to cpio To: hackers@freebsd.org Date: Sun, 17 Mar 1996 12:38:00 -0500 (EST) Cc: brian.haug@columbiasc.ncr.com Reply-To: haug@conterra.com X-Mailer: ELM [version 2.4 PL24 ME7a] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk The cpio utility gets into an infinite loop with the following input and command line: cpio -i a ln a b ln b c ls | cpio -oc >cpio.out2 begin 644 cpio.out2 M,#> 8) & 0x00ff)) *************** *** 484,489 **** --- 485,493 ---- if (fnmatch (save_patterns[i], file_hdr.c_name, 0) == 0) skip_file = !copy_matching_files; } + if (skip_file) { + skip_file = check_for_deferments(&file_hdr); + } } if (skip_file) *************** *** 1269,1272 **** --- 1273,1300 ---- error (0, errno, "%s", d->header.c_name); } } + } + + int + check_for_deferments(struct new_cpio_header *file_hdr) + { + struct deferment *d; + struct deferment *prev = NULL; + + for (d = deferments; d != NULL; d = d->next) { + if (file_hdr->c_ino == d->header.c_ino && + file_hdr->c_dev_maj == d->header.c_dev_maj && + file_hdr->c_dev_min == d->header.c_dev_min) { + free(file_hdr->c_name); + if (prev != NULL) + prev->next = d->next; + else + deferments = d->next; + file_hdr->c_name = strdup(d->header.c_name); + free_deferment(d); + return FALSE; + } + prev = d; + } + return TRUE; } Share and Enjoy! Brian