- Deal with some signedness issues
- Deal with some size issues
- Deal with NULL pointer issues
- Deal with some -Wunused issues
Change-Id: I1479dd90d690084491bae3475f2c547833519a57
This cleans up most of the size-related problems in system/core.
There are still a few changes needed for a clean 64-bit build,
but they look like they might require changes to things like the
fastboot protocol.
Change-Id: I1560425a289fa158e13e2e3173cc3e71976f92c0
Use ssize_t for handling the result of a readlink call.
Fix the following compiler warning:
system/core/toolbox/ls.c: In function 'listfile_maclabel':
system/core/toolbox/ls.c:238:68: warning: unused parameter 'flags' [-Wunused-parameter]
static int listfile_maclabel(const char *path, struct stat *s, int flags)
Change-Id: Idd65f3349fb9dfb6f7a374c81f72d3169af33505
Increase the size of the user/group buffer from 16 bytes
to 32 bytes. Some OEMs are creating usernames longer than
15 bytes, causing problems.
Use bounds checking functions when handling user/group
data, to avoid overflowing buffers.
Change-Id: I4a5824b819b0c37662ba4f33573af0d0e071b444
Comparison of signed and unsigned integers. Use parenthesis around a
group of bitwise OR operations.
Change-Id: Ia404380593ce2c2a291133c07c0fc7a016a3ad3f
Add -Z option to ls and ps for displaying security contexts.
Modify id to display security context.
Add new SELinux commands: chcon, getenforce, getsebool, load_policy, restorecon, runcon, setenforce, setsebool.
Change-Id: Ia20941be4a6cd706fe392fed6e38a37d880ec5f1
Adds a field to the non-long version of ls that tells what type of file
it is (i.e., regular, directory, link, fifo, etc).
This is useful for scripts that don't have direct filesystem access.
Change-Id: I54a327390f6ed403acb13c824f62ba9594ba320d
This patch also factors out the dynarray_t/strlist_t code
from ls.c and moves it to dynarray.[hc].
Change-Id: Ifae2b364d7c2733aad5551ad3c78ae72f8ac31f4
File size was cast to a signed integer which displayed files over 2GB as
negative sizes on devices. Use a long long for printing instead which
matches the stat struct.
Change-Id: I0ec07f33716bb4c2e5d120633ed435f637238f46
Sorts file and directory names properly in 'ls'
+ accept group flags (e.g. '-ld' instead of '-l -d')
+ accept flags in any position on the command line (e.g. 'ls foo -l' works)
Change-Id: Idc24a69ae31fe0c13726d39892357ac89a8830db
Added the "total" line, which makes it easy to answer questions like,
"how the hell much space am I wasting on /data/dalvik-cache?".
Also fixed the -s filename output, which was showing mostly-full paths
when a simple filename was called for.
This may not be useful, and may actually be misleading since yaffs2
doesn't track the blocks used for each file (it just divides the length
down by 512). I'm submitting it because yaffs2 isn't the only
filesystem we'll ever use.
I also changed some sprintf to snprintf, mostly out of paranoid habit.