aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2/arch/linux/common/nfs.h
blob: 675bc851a5df04db8ca3d2216a2ca724aacf9571 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
static gchar *nfs_shares_list = NULL;
void
scan_nfs_shared_directories(void)
{
    FILE *exports;
    gchar buf[512];
    
    if (nfs_shares_list) {
        g_free(nfs_shares_list);
    }

    nfs_shares_list = g_strdup("");
    
    exports = fopen("/etc/exports", "r");
    while (fgets(buf, 512, exports)) {
        if (buf[0] != '/')
            continue;
        
        strend(buf, ' ');
        strend(buf, '\t');

        nfs_shares_list = g_strconcat(nfs_shares_list, buf, "=\n", NULL);
    }
    fclose(exports);
}