/***
This file is part of systemd.
Copyright 2013 Zbigniew Jędrzejewski-Szmek
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "alloc-util.h"
#include "fd-util.h"
#include "namespace.h"
#include "process-util.h"
#include "string-util.h"
#include "util.h"
_cleanup_free_ char *a, *b;
struct stat x, y;
char *c, *d;
assert_se(startswith(a, A));
assert_se(startswith(b, B));
c = strjoina(a, "/tmp");
d = strjoina(b, "/tmp");
}
static void test_netns(void) {
int r, n = 0;
if (geteuid() > 0)
return;
if (pid1 == 0) {
r = setup_netns(s);
assert_se(r >= 0);
_exit(r);
}
if (pid2 == 0) {
r = setup_netns(s);
assert_se(r >= 0);
exit(r);
}
if (pid3 == 0) {
r = setup_netns(s);
assert_se(r >= 0);
exit(r);
}
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(n == 1);
}
assert_se(x && y);
test_tmpdir("abcd.service", x, y);
z = strjoin("/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-", NULL);
zz = strjoin("/var/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-", NULL);
test_tmpdir("sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device", z, zz);
test_netns();
return 0;
}