Date: Fri, 7 Aug 1998 15:50:01 -0700 (PDT) From: njs3@doc.ic.ac.uk (Niall Smart) To: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/7507: test cannot test for sockets Message-ID: <199808072250.PAA04402@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/7507; it has been noted by GNATS.
From: njs3@doc.ic.ac.uk (Niall Smart)
To: sec@42.org, FreeBSD-gnats-submit@freebsd.org
Cc: Subject: Re: bin/7507: test cannot test for sockets
Date: Fri, 7 Aug 1998 23:36:29 +0100
On Aug 5, 3:21am, Stefan `Sec` Zehl wrote:
} Subject: bin/7507: test cannot test for sockets
>
> >Description:
>
> /bin/test cannot test for unix domain sockets (as used by ssh)
>
> s-w--w--w- 1 root bin 0 Aug 5 02:51 agent-socket-10654
>
> Add such operator to /bin/test maybe as '-S' as zsh does ?
Suggested fix appended; -S is compatable with *BSD and Solaris.
Note: These patches apply to -current AND -stable cleanly.
If you apply this manually don't forget to update the
/bin/[ hard link.
Niall
Index: operators.c
===================================================================
RCS file: /cvs/src/bin/test/operators.c,v
retrieving revision 1.7
diff -C2 -r1.7 operators.c
*** operators.c 1998/05/18 06:51:53 1.7
--- operators.c 1998/08/07 22:26:56
***************
*** 67,70 ****
--- 67,71 ----
"-x",
"-z",
+ "-S",
NULL
};
***************
*** 115,118 ****
--- 116,120 ----
12,
12,
+ 12,
1,
1,
***************
*** 148,151 ****
--- 150,154 ----
OP_FILE,
OP_STRING,
+ OP_FILE,
0,
0,
Index: operators.h
===================================================================
RCS file: /cvs/src/bin/test/operators.h,v
retrieving revision 1.5
diff -C2 -r1.5 operators.h
*** operators.h 1997/02/22 14:06:22 1.5
--- operators.h 1998/08/07 22:26:56
***************
*** 53,70 ****
#define ISEXEC 16
#define NULSTR 17
! #define FIRST_BINARY_OP 18
! #define OR1 18
! #define OR2 19
! #define AND1 20
! #define AND2 21
! #define STREQ 22
! #define STRNE 23
! #define EQ 24
! #define NE 25
! #define GT 26
! #define LT 27
! #define LE 28
! #define GE 29
--- 53,71 ----
#define ISEXEC 16
#define NULSTR 17
+ #define ISSOCK 18
! #define FIRST_BINARY_OP 19
! #define OR1 FIRST_BINARY_OP
! #define OR2 (FIRST_BINARY_OP + 1)
! #define AND1 (FIRST_BINARY_OP + 2)
! #define AND2 (FIRST_BINARY_OP + 3)
! #define STREQ (FIRST_BINARY_OP + 4)
! #define STRNE (FIRST_BINARY_OP + 5)
! #define EQ (FIRST_BINARY_OP + 6)
! #define NE (FIRST_BINARY_OP + 7)
! #define GT (FIRST_BINARY_OP + 8)
! #define LT (FIRST_BINARY_OP + 9)
! #define LE (FIRST_BINARY_OP + 10)
! #define GE (FIRST_BINARY_OP + 11)
Index: test.1
===================================================================
RCS file: /cvs/src/bin/test/test.1,v
retrieving revision 1.6
diff -C2 -r1.6 test.1
*** test.1 1998/05/18 06:51:56 1.6
--- test.1 1998/08/07 22:26:57
***************
*** 100,103 ****
--- 100,107 ----
is a named pipe
.Po Tn FIFO Pc .
+ .It Fl S Ar file
+ True if
+ .Ar file
+ is a socket.
.It Fl r Ar file
True if
Index: test.c
===================================================================
RCS file: /cvs/src/bin/test/test.c,v
retrieving revision 1.19
diff -C2 -r1.19 test.c
*** test.c 1998/05/18 06:51:59 1.19
--- test.c 1998/08/07 22:27:00
***************
*** 395,398 ****
--- 395,401 ----
i = S_IFIFO;
goto filetype;
+ case ISSOCK:
+ i = S_IFSOCK;
+ goto filetype;
filetype: if ((fs->stat.st_mode & S_IFMT) == i && fs->rcode >= 0)
true: sp->u.num = 1;
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808072250.PAA04402>
