resolved.c revision 682265d5e2157882861b0091c6b81fa92699b72a
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
db9680b2bbd9d091b198eaa4e324762921965fb3Christian Maeder This file is part of systemd.
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder Copyright 2014 Tom Gundersen <teg@jklm.no>
db9680b2bbd9d091b198eaa4e324762921965fb3Christian Maeder systemd is free software; you can redistribute it and/or modify it
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder under the terms of the GNU Lesser General Public License as published by
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder the Free Software Foundation; either version 2.1 of the License, or
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder (at your option) any later version.
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder systemd is distributed in the hope that it will be useful, but
db9680b2bbd9d091b198eaa4e324762921965fb3Christian Maeder WITHOUT ANY WARRANTY; without even the implied warranty of
db9680b2bbd9d091b198eaa4e324762921965fb3Christian Maeder MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
db9680b2bbd9d091b198eaa4e324762921965fb3Christian Maeder Lesser General Public License for more details.
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder You should have received a copy of the GNU Lesser General Public License
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder along with systemd; If not, see <http://www.gnu.org/licenses/>.
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder _cleanup_manager_free_ Manager *m = NULL;
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder const char *user = "systemd-resolve";
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder log_error("This program takes no arguments.");
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder r = get_user_creds(&user, &uid, &gid, NULL, NULL);
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder log_error("Cannot resolve user name %s: %s", user, strerror(-r));
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder /* Always create the directory where resolv.conf will live */
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder r = mkdir_safe_label("/run/systemd/resolve", 0755, uid, gid);
db9680b2bbd9d091b198eaa4e324762921965fb3Christian Maeder log_error("Could not create runtime directory: %s",
db9680b2bbd9d091b198eaa4e324762921965fb3Christian Maeder log_error("Could not create manager: %s", strerror(-r));
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder log_error("Could not listen for network events: %s", strerror(-r));
7a7d13f347477e6daa89b9322aed2985dd7f9c56Christian Maeder /* write out default resolv.conf to avoid a
7a7d13f347477e6daa89b9322aed2985dd7f9c56Christian Maeder * dangling symlink */
7a7d13f347477e6daa89b9322aed2985dd7f9c56Christian Maeder log_error("Could not create resolv.conf: %s", strerror(-r));
db9680b2bbd9d091b198eaa4e324762921965fb3Christian Maeder "STATUS=Processing requests...");
7a7d13f347477e6daa89b9322aed2985dd7f9c56Christian Maeder log_error("Event loop failed: %s", strerror(-r));
7a7d13f347477e6daa89b9322aed2985dd7f9c56Christian Maeder "STATUS=Shutting down...");
7a7d13f347477e6daa89b9322aed2985dd7f9c56Christian Maeder return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;