OSDN Git Service
adbd: set sent file ownership per android fs config table
do_send() uses fs_config() to retrieve mode, user and group for a sent file but
handle_send_file() only gets passed the mode. User and group are discarded.
This causes problems as it means any files updated with adb sync will have their
owner set to root.
For example, the file "/system/etc/dbus.conf" should be owned by "bluetooth" as
specified in android_filesystem_config.h, and its permissions should be read for
user and group but nothing for other. Using adb sync to send this file means
that the owner is set to root, and no access permissions for others. This means
that when a process running as "bluetooth" tries to access the file it fails,
resulting in a boot failure.
This change adds a new wrapper function adb_chown() which calls chown() to match
the existing pattern for wrapping file I/O functions. This adb_chown() is now
called in do_send() to correctly set the owner and group as specified in the
fs_config table.
Change-Id: I37661273780346a6a868e58d9069171052e81e34