On Fri, Feb 17, 2012 at 04:47:51PM -0500, Dave Reisner wrote: > + tb = mnt_new_table(); > + if (!tb) { > + return -ENOMEM; > + } > > - while ((me = getmntent(f))) { > - char *where, *what; > - int k; > + mnt_cache = mnt_new_cache(); > + if (!mnt_cache) { > + r = -ENOMEM; > + goto finish; > + }
The cache is completely unnecessary here as you don't search in the table (fstab). > > - if (!(what = fstab_node_to_udev_node(me->mnt_fsname))) { > - r = -ENOMEM; > - goto finish; > - } > + mnt_table_set_cache(tb, mnt_cache); > > - if (!(where = strdup(me->mnt_dir))) { > - free(what); > - r = -ENOMEM; > - goto finish; > - } > + r = mnt_table_parse_fstab(tb, "/etc/fstab"); Please, use mnt_table_parse_fstab(tb, NULL); The filename is there to overwrite library default. > finish: > + if (tb) > + mnt_free_table(tb); > + if (mnt_cache) > + mnt_free_cache(mnt_cache); like libc free() all mnt_free_* functions accept NULL. -- Karel Zak <k...@redhat.com> http://karelzak.blogspot.com _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel