summaryrefslogtreecommitdiffstats
path: root/toolbox/ls.c
diff options
context:
space:
mode:
Diffstat (limited to 'toolbox/ls.c')
-rw-r--r--toolbox/ls.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/toolbox/ls.c b/toolbox/ls.c
index a4db99c..e530521 100644
--- a/toolbox/ls.c
+++ b/toolbox/ls.c
@@ -5,9 +5,7 @@
#include <dirent.h>
#include <errno.h>
-#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
-#endif
#include <sys/stat.h>
#include <unistd.h>
@@ -260,11 +258,7 @@ static int listfile_maclabel(const char *path, int flags)
return -1;
}
-#ifdef HAVE_SELINUX
lgetfilecon(path, &maclabel);
-#else
- maclabel = strdup("-");
-#endif
if (!maclabel) {
return -1;
}
@@ -276,12 +270,12 @@ static int listfile_maclabel(const char *path, int flags)
switch(s.st_mode & S_IFMT) {
case S_IFLNK: {
char linkto[256];
- int len;
+ ssize_t len;
len = readlink(path, linkto, sizeof(linkto));
if(len < 0) return -1;
- if(len > sizeof(linkto)-1) {
+ if((size_t)len > sizeof(linkto)-1) {
linkto[sizeof(linkto)-4] = '.';
linkto[sizeof(linkto)-3] = '.';
linkto[sizeof(linkto)-2] = '.';
@@ -307,7 +301,7 @@ static int listfile_maclabel(const char *path, int flags)
static int listfile(const char *dirname, const char *filename, int flags)
{
- if ((flags & LIST_LONG | LIST_SIZE | LIST_CLASSIFY | LIST_MACLABEL) == 0) {
+ if ((flags & (LIST_LONG | LIST_SIZE | LIST_CLASSIFY | LIST_MACLABEL)) == 0) {
printf("%s\n", filename);
return 0;
}