ALT Linux Bugzilla
– Attachment 988 Details for
Bug 7366
Патч для чтения содержимого /etc/fstab.d
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
/etc/fstab.d reading
util-linux-2.12p-fstab.d.patch (text/plain), 1.75 KB, created by
Vitaly Lipatov
on 2005-07-14 19:37:23 MSD
(
hide
)
Description:
/etc/fstab.d reading
Filename:
MIME Type:
Creator:
Vitaly Lipatov
Created:
2005-07-14 19:37:23 MSD
Size:
1.75 KB
patch
obsolete
>Patch for reading /etc/fstab.d files after /etc/fstab >Author: Daniil Davydov <koochy@etersoft.ru> >--- /home/koochy/Projects/fstab.c 2004-12-21 22:09:24 +0300 >+++ util-linux-2.12p/mount/fstab.c 2005-07-14 18:24:36 +0400 >@@ -9,6 +9,7 @@ > #include <stdio.h> > #include <string.h> > #include <sys/stat.h> >+#include <dirent.h> > #include "mntent.h" > #include "fstab.h" > #include "sundries.h" >@@ -173,26 +174,58 @@ > read_mntentchn(mfp, fnam, mc); > } > >-static void >-read_fstab() { >- mntFILE *mfp = NULL; >- const char *fnam; >- struct mntentchn *mc = &fstab; >- >- got_fstab = 1; >- mc->nxt = mc->prev = NULL; >+static int >+read_fstab_file(const char *fnam, struct mntentchn *mc){ > >- fnam = _PATH_FSTAB; >+ mntFILE *mfp = NULL; >+ > mfp = my_setmntent (fnam, "r"); >+ > if (mfp == NULL || mfp->mntent_fp == NULL) { > int errsv = errno; > error(_("warning: can't open %s: %s"), >- _PATH_FSTAB, strerror (errsv)); >- return; >+ fnam, strerror (errsv)); >+ return 0; > } > read_mntentchn(mfp, fnam, mc); >+ return 1; >+ >+} >+ >+static void >+read_fstab() { >+ >+ struct stat st; >+ char *dir_path; >+ DIR *dir; >+ struct dirent *entry; >+ char entry_path[PATH_MAX + 1]; >+ size_t path_len; >+ struct mntentchn *mc = &fstab; >+ >+ mc->nxt = mc->prev = NULL; >+ got_fstab = 1; >+ >+ if(!read_fstab_file(_PATH_FSTAB,mc)) return; >+ >+ dir_path = _PATH_FSTAB ".d/"; >+ strncpy (entry_path, dir_path, sizeof (entry_path)); >+ dir = opendir (dir_path); >+ path_len = strlen (dir_path); >+ >+ while((entry=readdir(dir))!=NULL) { >+ >+ strncpy (entry_path + path_len, entry->d_name, >+ sizeof (entry_path) - path_len); >+ lstat (entry_path, &st); >+ if (S_ISREG (st.st_mode)) >+ read_fstab_file(entry_path,mc); >+ >+ >+ } >+ closedir(dir); > } >- >+ > > /* Given the name NAME, try to find it in mtab. */ > struct mntentchn *
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 7366
: 988