summaryrefslogtreecommitdiffstats
path: root/misc-utils/namei.c
diff options
context:
space:
mode:
authorLi Zefan2007-09-10 10:20:48 +0200
committerKarel Zak2007-09-19 23:14:04 +0200
commitf062c8a69a4ebae1f3b24da6fb2be1cc51a69f7c (patch)
treeab8d49f64f7d51325f46ea882c7bb153c3f760dc /misc-utils/namei.c
parentsetarch: add long options to setarch and update manpage (diff)
downloadkernel-qcow2-util-linux-f062c8a69a4ebae1f3b24da6fb2be1cc51a69f7c.tar.gz
kernel-qcow2-util-linux-f062c8a69a4ebae1f3b24da6fb2be1cc51a69f7c.tar.xz
kernel-qcow2-util-linux-f062c8a69a4ebae1f3b24da6fb2be1cc51a69f7c.zip
namei: add to identify FIFO (named pipe) and update manpage
namei can't identify FIFO, and it will complain that it's an unknown type. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Diffstat (limited to 'misc-utils/namei.c')
-rw-r--r--misc-utils/namei.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/misc-utils/namei.c b/misc-utils/namei.c
index b0c33e814..948067537 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@cn.fujitsu.com>
+- 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);