[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-cpio] Re: Bug#565474: cpio makes device nodes into hard links when
From: |
Carl Miller |
Subject: |
[Bug-cpio] Re: Bug#565474: cpio makes device nodes into hard links when copying out of a cramfs image |
Date: |
Sat, 16 Jan 2010 15:25:09 -0800 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Sat, Jan 16, 2010 at 05:09:45AM +0000, Clint Adams wrote:
>
> You mean something like this?
>
>
> diff --git a/src/copyout.c b/src/copyout.c
> index 98f3895..f0741f7 100644
> --- a/src/copyout.c
> +++ b/src/copyout.c
> @@ -121,7 +121,9 @@ count_defered_links_to_dev_ino (struct cpio_file_stat
> *file_hdr)
> for (d = deferouts; d != NULL; d = d->next)
> {
> if ( (d->header.c_ino == ino) && (d->header.c_dev_maj == maj)
> - && (d->header.c_dev_min == min) )
> + && (d->header.c_dev_min == min)
> + && ((d->header.c_mode & CP_IFBLK) != CP_IFBLK)
> + && ((d->header.c_mode & CP_IFCHR) != CP_IFCHR) )
> ++count;
> }
> return count;
> @@ -178,7 +180,9 @@ writeout_other_defers (struct cpio_file_stat *file_hdr,
> int out_des)
> while (d != NULL)
> {
> if ( (d->header.c_ino == ino) && (d->header.c_dev_maj == maj)
> - && (d->header.c_dev_min == min) )
> + && (d->header.c_dev_min == min)
> + && ((d->header.c_mode & CP_IFBLK) != CP_IFBLK)
> + && ((d->header.c_mode & CP_IFCHR) != CP_IFCHR) )
> {
> struct deferment *d_free;
> d->header.c_filesize = 0;
Most excellent! Thank you, Clint! I'll try it out first thing Monday
morning. I hadn't had a chance to download and poke through the cpio
source yet, having only pinned down the bug clearly at 7:45 on a Friday
evening of a long, crazy day of work.
I was wondering if there's any likelihood of being tripped up by this
on any other file types (sockets? fifos?). I spent a few minutes today
poking through the Linux kernel source, but only found where directories
get rejected for hard-linking.
-------Carl