diff --git a/cr-dump.c b/cr-dump.c index ef779de26..b7418e8c2 100644 --- a/cr-dump.c +++ b/cr-dump.c @@ -352,15 +352,19 @@ err: return ret; } -static int dump_gen_file(struct fd_parms *p, int lfd, +static int dump_reg_file(struct fd_parms *p, int lfd, const struct cr_fdset *cr_fdset) { p->id = MAKE_FD_GENID(p->stat.st_dev, p->stat.st_ino, p->pos); - if (S_ISFIFO(p->stat.st_mode)) - p->type = FDINFO_PIPE; - else - p->type = FDINFO_REG; + p->type = FDINFO_REG; + return do_dump_gen_file(p, lfd, cr_fdset); +} +static int dump_pipe(struct fd_parms *p, int lfd, + const struct cr_fdset *cr_fdset) +{ + p->id = MAKE_FD_GENID(p->stat.st_dev, p->stat.st_ino, p->pos); + p->type = FDINFO_PIPE; return do_dump_gen_file(p, lfd, cr_fdset); } @@ -454,7 +458,7 @@ static int dump_chrdev(struct fd_parms *p, int lfd, const struct cr_fdset *set) maj = major(p->stat.st_rdev); if (maj == MEM_MAJOR) - return dump_gen_file(p, lfd, set); + return dump_reg_file(p, lfd, set); if (p->fd < 3 && (maj == TTY_MAJOR || maj == UNIX98_PTY_SLAVE_MAJOR)) { @@ -486,6 +490,10 @@ static int dump_inotify(struct fd_parms *p, int lfd, const struct cr_fdset *set) return do_dump_gen_file(p, lfd, set); } +#ifndef PIPEFS_MAGIC +#define PIPEFS_MAGIC 0x50495045 +#endif + static int dump_one_file(pid_t pid, int fd, int lfd, char fd_flags, const struct cr_fdset *cr_fdset) { @@ -518,9 +526,11 @@ static int dump_one_file(pid_t pid, int fd, int lfd, char fd_flags, } if (S_ISREG(p.stat.st_mode) || - S_ISDIR(p.stat.st_mode) || - S_ISFIFO(p.stat.st_mode)) - return dump_gen_file(&p, lfd, cr_fdset); + S_ISDIR(p.stat.st_mode)) + return dump_reg_file(&p, lfd, cr_fdset); + + if (S_ISFIFO(p.stat.st_mode) && (statfs.f_type == PIPEFS_MAGIC)) + return dump_pipe(&p, lfd, cr_fdset); return dump_unsupp_fd(&p); } diff --git a/include/image.h b/include/image.h index f4d8a947c..409f02548 100644 --- a/include/image.h +++ b/include/image.h @@ -39,8 +39,6 @@ #define INOTIFY_MAGIC 0x48424431 /* Volgograd */ #define INOTIFY_WMAGIC 0x54562009 /* Svetlogorsk (Rauschen) */ -#define PIPEFS_MAGIC 0x50495045 - enum fd_types { FDINFO_UND, FDINFO_REG,