ports/52452: [PATCH] sysutils/afio mangles FIFOs
Joshua Oreman
oremanj at www.get-linux.org
Tue May 20 01:40:14 UTC 2003
>Number: 52452
>Category: ports
>Synopsis: [PATCH] sysutils/afio mangles FIFOs
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon May 19 18:40:10 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator: oremanj
>Release: FreeBSD 5.0-CURRENT i386
>Organization:
home
>Environment:
System: FreeBSD webserver.get-linux.org 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Wed May 7 17:32:53 PDT 2003 root at webserver.get-linux.org:/usr/obj/usr/src/sys/GENERIC i386
>Description:
When run under FreeBSD, `afio' will successfully back up FIFOs, but will
not correctly restore them. The problem arises from `afio' using mknod(2)
to try to create a FIFO - a Linuxism. The correct function for it to use
is mkfifo(2).
Also, `afio' tries to recreate sockets. This behavior should be disabled
under FreeBSD.
>How-To-Repeat:
$ mkfifo testfifo
$ echo testfifo | afio -ov testfifo.afio
testfifo -- okay
$ rm testfifo
$ afio -iv testfifo.afio
afio: testfifo: Invalid argument
testfifo -- okay
$ echo $?
1
$ ls -l testfifo
ls: testfifo: No such file or directory
>Fix:
Put this patch in /usr/ports/sysutils/afio/files/patch-ad:
-------[snip]--
--- afio.c.orig Mon May 19 18:11:57 2003
+++ afio.c Mon May 19 18:24:07 2003
@@ -2953,14 +2953,14 @@
if (perm != operm && chmod (name, perm) < 0)
return (warn (name, syserr ()));
else { ; }
- else if (mknod (name, asb->sb_mode, (dev_t) 0) < 0
+ else if (mkfifo (name, asb->sb_mode) < 0
&& (errno != ENOENT
|| dirneed (name) < 0
- || mknod (name, asb->sb_mode, (dev_t) 0) < 0))
+ || mkfifo (name, asb->sb_mode) < 0))
return (warn (name, syserr ()));
break;
#endif /* S_IFIFO */
-#ifdef S_IFSOCK
+#ifdef S_IFSOCK && !defined (__FreeBSD__)
case S_IFSOCK:
fd = 0;
if (exists)
-------[snip]--
Remake the port, and the problem is fixed.
$ mkfifo testfifo
$ echo testfifo | afio -ov testfifo.afio
testfifo -- okay
$ rm testfifo
$ afio -iv testfifo.afio
testfifo -- okay
$ echo $?
0
$ ls -l testfifo
prw-r--r-- 1 oremanj oremanj 0 May 19 18:35 testfifo|
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list