chiark / gitweb /
systemctl: before spawning pager cache number of columns
[elogind.git] / src / util.c
index 21afdceb8cc4cf666de6d36318c1ea30be175de7..30a3b058fce07cf9cc1ad142509248482b201655 100644 (file)
@@ -3090,6 +3090,9 @@ void status_welcome(void) {
         status_printf("Welcome to \x1B[%sm%s\x1B[0m!\n",
                       const_color ? const_color : ansi_color,
                       const_pretty ? const_pretty : pretty_name);
+
+        free(ansi_color);
+        free(pretty_name);
 }
 
 char *replace_env(const char *format, char **env) {
@@ -3436,7 +3439,18 @@ bool null_or_empty(struct stat *st) {
 }
 
 DIR *xopendirat(int fd, const char *name, int flags) {
-        return fdopendir(openat(fd, name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|flags));
+        int nfd;
+        DIR *d;
+
+        if ((nfd = openat(fd, name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|flags)) < 0)
+                return NULL;
+
+        if (!(d = fdopendir(nfd))) {
+                close_nointr_nofail(nfd);
+                return NULL;
+        }
+
+        return d;
 }
 
 int signal_from_string_try_harder(const char *s) {
@@ -3517,7 +3531,7 @@ char *fstab_node_to_udev_node(const char *p) {
                 if (!t)
                         return NULL;
 
-                r = asprintf(&dn, "/dev/disk/by-uuid/%s", ascii_strlower(t));
+                r = asprintf(&dn, "/dev/disk/by-uuid/%s", t);
                 free(t);
 
                 if (r < 0)