diff --git a/src/basic/chase-symlinks.c b/src/basic/chase-symlinks.c index fc6e26d2f2..385d0aed69 100644 --- a/src/basic/chase-symlinks.c +++ b/src/basic/chase-symlinks.c @@ -559,7 +559,7 @@ int chase_symlinks_and_opendir( return r; assert(path_fd >= 0); - d = opendir(FORMAT_PROC_FD_PATH(path_fd)); + d = xopendirat(path_fd, ".", O_NOFOLLOW); if (!d) return -errno; diff --git a/src/basic/glyph-util.c b/src/basic/glyph-util.c index 67f2270daf..de1224f04f 100644 --- a/src/basic/glyph-util.c +++ b/src/basic/glyph-util.c @@ -71,6 +71,7 @@ const char *special_glyph(SpecialGlyph code) { [SPECIAL_GLYPH_RECYCLING] = "~", [SPECIAL_GLYPH_DOWNLOAD] = "\\", [SPECIAL_GLYPH_SPARKLES] = "*", + [SPECIAL_GLYPH_WARNING_SIGN] = "!", }, /* UTF-8 */ @@ -124,10 +125,11 @@ const char *special_glyph(SpecialGlyph code) { /* This emoji is a single character cell glyph in Unicode, and two in ASCII */ [SPECIAL_GLYPH_TOUCH] = u8"👆", /* actually called: BACKHAND INDEX POINTING UP */ - /* These three emojis are single character cell glyphs in Unicode and also in ASCII. */ + /* These four emojis are single character cell glyphs in Unicode and also in ASCII. */ [SPECIAL_GLYPH_RECYCLING] = u8"♻️", /* actually called: UNIVERSAL RECYCLNG SYMBOL */ [SPECIAL_GLYPH_DOWNLOAD] = u8"⤵️", /* actually called: RIGHT ARROW CURVING DOWN */ [SPECIAL_GLYPH_SPARKLES] = u8"✨", + [SPECIAL_GLYPH_WARNING_SIGN] = u8"⚠️", }, }; diff --git a/src/basic/glyph-util.h b/src/basic/glyph-util.h index 621d7a85b7..b64639622e 100644 --- a/src/basic/glyph-util.h +++ b/src/basic/glyph-util.h @@ -44,6 +44,7 @@ typedef enum SpecialGlyph { SPECIAL_GLYPH_RECYCLING, SPECIAL_GLYPH_DOWNLOAD, SPECIAL_GLYPH_SPARKLES, + SPECIAL_GLYPH_WARNING_SIGN, _SPECIAL_GLYPH_MAX, _SPECIAL_GLYPH_INVALID = -EINVAL, } SpecialGlyph; diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 0a12bcebc3..d13c7867e2 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -22,6 +22,7 @@ #include "rlimit-util.h" #include "sigbus.h" #include "signal-util.h" +#include "stat-util.h" #include "string-table.h" #include "systemctl-add-dependency.h" #include "systemctl-cancel-job.h" @@ -1157,6 +1158,13 @@ static int run(int argc, char *argv[]) { if (r <= 0) goto finish; + if (proc_mounted() == 0) + log_warning("%s%s/proc/ is not mounted. This is not a supported mode of operation. Please fix\n" + "your invocation environment to mount /proc/ and /sys/ properly. Proceeding anyway.\n" + "Your mileage may vary.", + emoji_enabled() ? special_glyph(SPECIAL_GLYPH_WARNING_SIGN) : "", + emoji_enabled() ? " " : ""); + if (arg_action != ACTION_SYSTEMCTL && running_in_chroot() > 0) { if (!arg_quiet) log_info("Running in chroot, ignoring request."); diff --git a/src/test/test-locale-util.c b/src/test/test-locale-util.c index aa501b650a..dd96af6894 100644 --- a/src/test/test-locale-util.c +++ b/src/test/test-locale-util.c @@ -82,7 +82,7 @@ TEST(keymaps) { #define dump_glyph(x) log_info(STRINGIFY(x) ": %s", special_glyph(x)) TEST(dump_special_glyphs) { - assert_cc(SPECIAL_GLYPH_SPARKLES + 1 == _SPECIAL_GLYPH_MAX); + assert_cc(SPECIAL_GLYPH_WARNING_SIGN + 1 == _SPECIAL_GLYPH_MAX); log_info("is_locale_utf8: %s", yes_no(is_locale_utf8())); @@ -119,6 +119,7 @@ TEST(dump_special_glyphs) { dump_glyph(SPECIAL_GLYPH_RECYCLING); dump_glyph(SPECIAL_GLYPH_DOWNLOAD); dump_glyph(SPECIAL_GLYPH_SPARKLES); + dump_glyph(SPECIAL_GLYPH_WARNING_SIGN); } DEFINE_TEST_MAIN(LOG_INFO);