X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=os-posix.c;h=52ef6990ff9d4c4e2cd52b6f6a820cdbb8efb9fb;hb=913e47cb6b6dba3c9ae705d3d67377a03ee499ac;hp=a8e38c0298823f039e7ac0f1fecba26be06f44b3;hpb=433aed5f3963950d94661f7e4974011abb4ff7e4;p=qmiga%2Fqemu.git diff --git a/os-posix.c b/os-posix.c index a8e38c0298..52ef6990ff 100644 --- a/os-posix.c +++ b/os-posix.c @@ -29,8 +29,6 @@ #include #include -/* Needed early for CONFIG_BSD etc. */ -#include "net/slirp.h" #include "qemu/error-report.h" #include "qemu/log.h" #include "sysemu/runstate.h" @@ -96,13 +94,13 @@ static uid_t user_uid = (uid_t)-1; /* -1 -1 >=0 */ static gid_t user_gid = (gid_t)-1; /* -1 -1 >=0 */ /* - * Prepare to change user ID. optarg can be one of 3 forms: + * Prepare to change user ID. user_id can be one of 3 forms: * - a username, in which case user ID will be changed to its uid, * with primary and supplementary groups set up too; * - a numeric uid, in which case only the uid will be set; * - a pair of numeric uid:gid. */ -bool os_set_runas(const char *optarg) +bool os_set_runas(const char *user_id) { unsigned long lv; const char *ep; @@ -110,14 +108,14 @@ bool os_set_runas(const char *optarg) gid_t got_gid; int rc; - user_pwd = getpwnam(optarg); + user_pwd = getpwnam(user_id); if (user_pwd) { user_uid = -1; user_gid = -1; return true; } - rc = qemu_strtoul(optarg, &ep, 0, &lv); + rc = qemu_strtoul(user_id, &ep, 0, &lv); got_uid = lv; /* overflow here is ID in C99 */ if (rc || *ep != ':' || got_uid != lv || got_uid == (uid_t)-1) { return false; @@ -175,9 +173,9 @@ static void change_process_uid(void) static const char *chroot_dir; -void os_set_chroot(const char *optarg) +void os_set_chroot(const char *path) { - chroot_dir = optarg; + chroot_dir = path; } static void change_root(void)