[PATCH] namei: add to identify FIFO (named pipe) and update manpage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



namei can't identify FIFO, and it will complain that it's an unknown type.

Signed-off-by: Li Zefan <lizf@xxxxxxxxxxxxxx>
---
 namei.1 |    1 +
 namei.c |   11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/misc-utils/namei.1 b/misc-utils/namei.1
index ad37574..394eb6d 100644
--- a/misc-utils/namei.1
+++ b/misc-utils/namei.1
@@ -33,6 +33,7 @@ outputs a the following characters to identify the file types found:
     s = socket
     b = block device
     c = character device
+    p = FIFO (named pipe)
     - = regular file
     ? = an error of some kind
 .fi
diff --git a/misc-utils/namei.c b/misc-utils/namei.c
index b0c33e8..9480675 100644
--- a/misc-utils/namei.c
+++ b/misc-utils/namei.c
@@ -30,6 +30,7 @@ For each line output, the program puts a file type first:
     s = socket
     b = block device
     c = character device
+    p = FIFO (named pipe)
     - = regular file
     ? = an error of some kind
 
@@ -46,6 +47,9 @@ chdir to /,  or if it encounters an unknown file type.
 - fixed logic; don't follow the path if a component is not directory
 - fixed infinite loop of symbolic links; stack size is very limited
 
+2007-09-10 Li Zefan <lizf@xxxxxxxxxxxxxx>
+- added to identify FIFO
+
 -------------------------------------------------------------*/
 
 #include <stdio.h>
@@ -306,6 +310,13 @@ namei(char *file, int lev, mode_t *lastmode) {
 		    (void)printf(" s %s\n", buf);
 		break;
 
+		case S_IFIFO:
+		if (mflag)
+			printf(" p%s %s\n", pperm(stb.st_mode), buf);
+		else
+			printf(" p %s\n", buf);
+		break;
+
 	    case S_IFREG:
 		if(mflag)
 		    (void)printf(" -%s %s\n", pperm(stb.st_mode), buf);

---

-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux