BjoKaSH / maczfs-archive

Legacy MacZFS - Archived here due Google-code shutdown. Automatically exported from code.google.com/p/maczfs -- Do Not Use! Use https://openzfsonosx.org/
Other
1 stars 0 forks source link

get_numeric_property() has "hackish" code #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
/usr/src/lib/libzfs/common/libzfs_dataset.c
----
/*XXXNOEL this code will work but is hackish 
 */
if (getmntany(mnttab, &entry, &search) == 0) {
    zhp->zfs_mntopts = zfs_strdup(zhp->zfs_hdl,
        entry.mnt_mntopts);
    if (zhp->zfs_mntopts == NULL)
        return (-1);
}
----

Why is it hackish?

Better yet, what is the right way?

Original issue reported on code.google.com by jason.richard.mcneil on 21 Feb 2010 at 6:21

GoogleCodeExporter commented 9 years ago

Original comment by jason.richard.mcneil on 28 Feb 2010 at 10:14

GoogleCodeExporter commented 9 years ago
This is what the code looked like in the 10a286 bits:

                search.mnt_special = (char *)zhp->zfs_name;
                search.mnt_fstype = MNTTYPE_ZFS;
#ifndef __APPLE__
                rewind(mnttab);
#endif

                if (getmntany(mnttab, &entry, &search) == 0) {
                        zhp->zfs_mntopts = zfs_strdup(zhp->zfs_hdl,
                            entry.mnt_mntopts);
                        if (zhp->zfs_mntopts == NULL)
                                return (-1);
                }

                zhp->zfs_mntcheck = B_TRUE;

So I think we just ditch the comment and the ifdef 

Original comment by alex.ble...@gmail.com on 17 Jul 2010 at 9:41

GoogleCodeExporter commented 9 years ago
Fixed in 
http://github.com/alblue/mac-zfs/commit/6bebda089240cdc346347dffa37677bf4a2f70c7

Original comment by alex.ble...@gmail.com on 17 Jul 2010 at 10:41