chiark / gitweb /
hostnamed: allow UTF8 chars in pretty hostname again
[elogind.git] / src / shared / util.c
index 1e1eb2af5f1bdfc6093b6490c9fa662b91cf1210..1c97a8a94ae65386b7731c672e4e1248d7f65826 100644 (file)
@@ -1959,7 +1959,7 @@ char *format_timestamp(char *buf, size_t l, usec_t t) {
 
         sec = (time_t) (t / USEC_PER_SEC);
 
-        if (strftime(buf, l, "%a, %d %b %Y %H:%M:%S %z", localtime_r(&sec, &tm)) <= 0)
+        if (strftime(buf, l, "%a, %Y-%m-%d %H:%M:%S %Z", localtime_r(&sec, &tm)) <= 0)
                 return NULL;
 
         return buf;
@@ -5929,7 +5929,7 @@ bool string_is_safe(const char *p) {
         assert(p);
 
         for (t = p; *t; t++) {
-                if (*t < ' ')
+                if (*t > 0 && *t < ' ')
                         return false;
 
                 if (strchr("\\\"\'", *t))