dev-setup.c revision 03cfe0d51499e86b1573d121337594719d9f2012
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering This file is part of systemd.
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering Copyright 2010-2012 Lennart Poettering
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering systemd is free software; you can redistribute it and/or modify it
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering under the terms of the GNU Lesser General Public License as published by
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering (at your option) any later version.
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering systemd is distributed in the hope that it will be useful, but
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering Lesser General Public License for more details.
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering You should have received a copy of the GNU Lesser General Public License
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
bd5f920f1288c0d4d488629fadf067f709227030Lennart Poetteringint dev_setup(const char *prefix, uid_t uid, gid_t gid) {
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering static const char symlinks[] =
a4152e3fe28b53b8919cc404dd7eca7ead1bf9bdLennart Poettering const char *j, *k;
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering const char *n;
e821075a23fdfa3ca7738fc30bb2d4c430fe10c0Lennart Poettering if (j[0] == '-') {
a4152e3fe28b53b8919cc404dd7eca7ead1bf9bdLennart Poettering log_debug_errno(r, "Failed to symlink %s to %s: %m", j, n);
a4152e3fe28b53b8919cc404dd7eca7ead1bf9bdLennart Poettering if (uid != UID_INVALID || gid != GID_INVALID)
a4152e3fe28b53b8919cc404dd7eca7ead1bf9bdLennart Poettering log_debug_errno(errno, "Failed to chown %s: %m", n);