On 10/13/2014 04:08 PM, Jakub Hrozek wrote:
+void test_run_as_root_daemon(void **state)
+{
+ int ret;
+ struct main_context *main_ctx;
+ struct passwd *sssd;
+ pid_t pid;
+ char *pidfile;
+
+ /* Must root as root, real or fake */
+ assert_int_equal(geteuid(), 0);
+
+ sssd = getpwnam("sssd");
+ assert_non_null(sssd);
I think that sssd variable is copy&paste mistake
here.
+
+ pidfile = talloc_asprintf(NULL, "%s/%s.pid", TEST_PID_PATH,
__FUNCTION__);
+
+ /* Make sure there are no leftovers */
+ unlink(pidfile);
+
+ pid = fork();
+ if (pid == 0) {
+ ret = server_setup(__FUNCTION__, FLAGS_PID_FILE,
+ 0, 0, __FUNCTION__, &main_ctx);
+ assert_int_equal(ret, 0);
+
+ server_loop(main_ctx);
+ exit(0);
+ }
+
+ wait_for_bg_server(pidfile);
+ talloc_free(pidfile);
+}