From 93a680280ffd538444d996482e4885cdd8cfbe95 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Fri, 10 Apr 2009 11:33:23 -0400 Subject: [PATCH] Author: Daniel J Walsh Email: dwalsh@redhat.com Subject: Patch matchpathcon to eliminate file "/" Date: Wed, 04 Mar 2009 15:39:31 -0500 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 So matchpathcon /etc/ Will work the same as matchpathcon /etc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkmu5wMACgkQrlYvE4MpobNK4gCgiVeXXEZcCMsJKXM7jqh6r1u3 OScAoLcmXBIR63gpvA8RS3g07pcPC6IF =e+Re -----END PGP SIGNATURE----- Signed-off-by: Chad Sellers --- libselinux/utils/matchpathcon.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libselinux/utils/matchpathcon.c b/libselinux/utils/matchpathcon.c index 35fa39f1..c57f6ca8 100644 --- a/libselinux/utils/matchpathcon.c +++ b/libselinux/utils/matchpathcon.c @@ -101,6 +101,11 @@ int main(int argc, char **argv) for (i = optind; i < argc; i++) { int mode = 0; struct stat buf; + int len = strlen(argv[i]); + if (len > 1 && argv[i][len - 1 ] == '/') { + argv[i][len - 1 ] = '\0'; + } + if (lstat(argv[i], &buf) == 0) mode = buf.st_mode;