[systemd-commits] 4 commits - TODO src/fstab-generator

Lennart Poettering lennart at kemper.freedesktop.org
Mon Mar 25 10:20:28 PDT 2013


 TODO                                  |    6 ++---
 src/fstab-generator/fstab-generator.c |   39 +++++++++++++++++++---------------
 2 files changed, 25 insertions(+), 20 deletions(-)

New commits:
commit 80c39ad27f5e99b1f18bdacd2b27a05ddee6cca1
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Mar 25 18:19:52 2013 +0100

    fstab-generator: fix minor memory leak on error path

diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index a0a87a1..7f065eb 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -468,8 +468,8 @@ finish:
 }
 
 static int parse_new_root_from_proc_cmdline(void) {
-        char *w, *state;
         _cleanup_free_ char *what = NULL, *type = NULL, *opts = NULL, *line = NULL;
+        char *w, *state;
         int r;
         size_t l;
 
@@ -487,7 +487,7 @@ static int parse_new_root_from_proc_cmdline(void) {
         /* root= and roofstype= may occur more than once, the last instance should take precedence.
          * In the case of multiple rootflags= the arguments should be concatenated */
         FOREACH_WORD_QUOTED(w, l, line, state) {
-                char *word, *tmp_word;
+                _cleanup_free_ char *word;
 
                 word = strndup(w, l);
                 if (!word)
@@ -506,22 +506,25 @@ static int parse_new_root_from_proc_cmdline(void) {
                                 return log_oom();
 
                 } else if (startswith(word, "rootflags=")) {
-                        tmp_word = opts;
-                        opts = strjoin(opts, ",", word + 10, NULL);
-                        free(tmp_word);
-                        if (!opts)
+                        char *o;
+
+                        o = strjoin(opts, ",", word + 10, NULL);
+                        if (!o)
                                 return log_oom();
 
+                        free(opts);
+                        opts = o;
+
                 } else if (streq(word, "ro") || streq(word, "rw")) {
-                        tmp_word = opts;
-                        opts = strjoin(opts, ",", word, NULL);
-                        free(tmp_word);
-                        if (!opts)
+                        char *o;
+
+                        o = strjoin(opts, ",", word, NULL);
+                        if (!o)
                                 return log_oom();
 
+                        free(opts);
+                        opts = o;
                 }
-
-                free(word);
         }
 
         if (!what) {

commit df3e57f542cf680cd891dfbd85615885b54770dc
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Mar 25 18:18:57 2013 +0100

    fstab-generator: add missing OOM check

diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index d5f9db4..a0a87a1 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -389,13 +389,15 @@ static int add_mount(const char *what, const char *where, const char *type, cons
 }
 
 static int parse_fstab(const char *prefix, bool initrd) {
-        FILE *f;
         _cleanup_free_ char *fstab_path = NULL;
+        FILE *f;
         int r = 0;
         struct mntent *me;
 
-        errno = 0;
-        fstab_path = strjoin(prefix, "/etc/fstab", NULL);
+        fstab_path = strjoin(strempty(prefix), "/etc/fstab", NULL);
+        if (!fstab_path)
+                return log_oom();
+
         f = setmntent(fstab_path, "r");
         if (!f) {
                 if (errno == ENOENT)
@@ -614,7 +616,7 @@ int main(int argc, char *argv[]) {
         if (!arg_enabled)
                 return (r < 0) ? EXIT_FAILURE : EXIT_SUCCESS;
 
-        k = parse_fstab("", false);
+        k = parse_fstab(NULL, false);
 
         if (in_initrd())
                 l = parse_fstab("/sysroot", true);

commit 790838e4f16831f2bb06aeb845b9e2fb0f1d28dd
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Mar 25 18:18:09 2013 +0100

    fstab-generator: rename x-initrd-rootfs.mount to x-initrd.rootfs
    
    This changes the fstab mount option x-initrd-rootfs.mount to
    x-initrd.rootfs, in order to only use a single namespace "x-initrd." for
    all mount options of the initrd.

diff --git a/TODO b/TODO
index 646fad8..f218d18 100644
--- a/TODO
+++ b/TODO
@@ -59,8 +59,6 @@ Features:
 * introduce timers.target and paths.target and automatucally order all
   timers and paths before it and after sysinit.target.
 
-* x-initrd-rootfs.mount in fstab-generator needs to go or get a saner name
-
 * matching against units is currently broken in journalctl. We really
   need another AND level in the expressions,
   i.e. sd_journal_add_conjunction().
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index cf85d31..d5f9db4 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -202,7 +202,7 @@ static bool mount_in_initrd(struct mntent *me) {
 static bool mount_is_rootfs(struct mntent *me) {
         assert(me);
 
-        return hasmntopt(me, "x-initrd-rootfs.mount");
+        return hasmntopt(me, "x-initrd.rootfs");
 }
 
 static int add_mount(const char *what, const char *where, const char *type, const char *opts,

commit eece8c6fb5f4d354dcef6fd369e876c4f3a3f163
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Mar 25 18:17:15 2013 +0100

    update TODO

diff --git a/TODO b/TODO
index 8227792..646fad8 100644
--- a/TODO
+++ b/TODO
@@ -44,6 +44,9 @@ Fedora 19:
 
 Features:
 
+* when isolating, try to figure out a way how we implicitly can order
+  all units we stop before the isolating unit...
+
 * when prompting for a hdd password show GUID partition label
 
 * teach udev + logind's uaccess to somehow handle the "dead" device nodes from:
@@ -223,7 +226,6 @@ Features:
     and !FOOBAR for events without FOOBAR.
   - journal: when rotating, copy over old acls/access mode
   - journal: send out marker messages every now and then, and immediately sync with fdatasync() afterwards, in order to have hourly guaranteed syncs.
-  - journal: when we haven't written anything in a while, sync to disk and mark file as offline, in order to be more often than not in a clean state
   - journal-send.c, log.c: when the log socket is clogged, and we drop, count this and write a message about this when it gets unclogged again.
   - journal: find a way to allow dropping history early, based on priority, other rules
   - journal: When used on NFS, check payload hashes



More information about the systemd-commits mailing list