diff options
Diffstat (limited to 'toolbox')
| -rw-r--r-- | toolbox/ls.c | 11 | ||||
| -rw-r--r-- | toolbox/mkdosfs.c | 2 | ||||
| -rw-r--r-- | toolbox/mount.c | 7 | ||||
| -rw-r--r-- | toolbox/smd.c | 1 |
4 files changed, 14 insertions, 7 deletions
diff --git a/toolbox/ls.c b/toolbox/ls.c index f609df2..087e4d5 100644 --- a/toolbox/ls.c +++ b/toolbox/ls.c @@ -15,9 +15,10 @@ #include <linux/kdev_t.h> // bits for flags argument -#define LIST_LONG (1 << 0) -#define LIST_ALL (1 << 1) -#define LIST_RECURSIVE (1 << 2) +#define LIST_LONG (1 << 0) +#define LIST_ALL (1 << 1) +#define LIST_RECURSIVE (1 << 2) +#define LIST_DIRECTORIES (1 << 3) // fwd static int listpath(const char *name, int flags); @@ -238,7 +239,7 @@ static int listpath(const char *name, int flags) return -1; } - if (S_ISDIR(s.st_mode)) { + if ((flags & LIST_DIRECTORIES) == 0 && S_ISDIR(s.st_mode)) { if (flags & LIST_RECURSIVE) printf("\n%s:\n", name); return listdir(name, flags); @@ -269,6 +270,8 @@ int ls_main(int argc, char **argv) flags |= LIST_ALL; } else if (!strcmp(argv[i], "-R")) { flags |= LIST_RECURSIVE; + } else if (!strcmp(argv[i], "-d")) { + flags |= LIST_DIRECTORIES; } else { listed++; if(listpath(argv[i], flags) != 0) { diff --git a/toolbox/mkdosfs.c b/toolbox/mkdosfs.c index 744aad1..66e720b 100644 --- a/toolbox/mkdosfs.c +++ b/toolbox/mkdosfs.c @@ -393,7 +393,7 @@ mkdosfs_main(int argc, char *argv[]) bpb.bsec = length / bpb.bps; bpb.spt = bpb.bsec; // use FAT32 for 2 gig or greater - if (length >= 2 *1024 *1024 *1024) { + if (length >= 2LL *1024 *1024 *1024) { fat = 32; } else { fat = 16; diff --git a/toolbox/mount.c b/toolbox/mount.c index 86047a9..472c952 100644 --- a/toolbox/mount.c +++ b/toolbox/mount.c @@ -138,14 +138,17 @@ do_mount(char *dev, char *dir, char *type, unsigned long rwflag, void *data, int if (loop) { int file_fd, device_fd; + int flags; + + flags = (rwflag & MS_RDONLY) ? O_RDONLY : O_RDWR; // FIXME - only one loop mount supported at a time - file_fd = open(dev, O_RDWR); + file_fd = open(dev, flags); if (file_fd < -1) { perror("open backing file failed"); return 1; } - device_fd = open(LOOP_DEVICE, O_RDWR); + device_fd = open(LOOP_DEVICE, flags); if (device_fd < -1) { perror("open loop device failed"); close(file_fd); diff --git a/toolbox/smd.c b/toolbox/smd.c index 65ff994..91e495c 100644 --- a/toolbox/smd.c +++ b/toolbox/smd.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <fcntl.h> #include <errno.h> |
