summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/libugly/getmntent.c
diff options
context:
space:
mode:
authorGwenolé Beauchesne <gbeauchesne@mandriva.org>2003-06-04 18:31:57 +0000
committerGwenolé Beauchesne <gbeauchesne@mandriva.org>2003-06-04 18:31:57 +0000
commit09e967c2d732783b2579e4e120cd9b608404cb00 (patch)
tree8d2783a6a7e33608c6012efd6a88b8f5694df81d /mdk-stage1/dietlibc/libugly/getmntent.c
parent18fcff49d3c836697d3b75a3d01d31c700e69974 (diff)
downloaddrakx-09e967c2d732783b2579e4e120cd9b608404cb00.tar
drakx-09e967c2d732783b2579e4e120cd9b608404cb00.tar.gz
drakx-09e967c2d732783b2579e4e120cd9b608404cb00.tar.bz2
drakx-09e967c2d732783b2579e4e120cd9b608404cb00.tar.xz
drakx-09e967c2d732783b2579e4e120cd9b608404cb00.zip
Merge from R9_0-AMD64, most notably:
- AMD64 support to insmod-busybox, minilibc, et al. - Sync with insmod-modutils 2.4.19 something but everyone should use dietlibc nowadays - Factor out compilation and prefix with $(DIET) for dietlibc builds - 64-bit & varargs fixes
Diffstat (limited to 'mdk-stage1/dietlibc/libugly/getmntent.c')
-rw-r--r--mdk-stage1/dietlibc/libugly/getmntent.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/mdk-stage1/dietlibc/libugly/getmntent.c b/mdk-stage1/dietlibc/libugly/getmntent.c
index 250a77b7f..1a1bdca24 100644
--- a/mdk-stage1/dietlibc/libugly/getmntent.c
+++ b/mdk-stage1/dietlibc/libugly/getmntent.c
@@ -5,11 +5,11 @@
struct mntent *getmntent(FILE *filep) {
static struct mntent m;
- char buf[1024];
+ static char buf[1024];
do {
char *tmp=buf;
int num;
- fgets(buf,1024,filep);
+ if (!fgets(buf,1024,filep)) return 0;
/* "/dev/ide/host0/bus0/target0/lun0/part2 / reiserfs defaults 1 1" */
for (num=0; num<6; ++num) {
switch (num) {
@@ -17,12 +17,13 @@ struct mntent *getmntent(FILE *filep) {
case 1: m.mnt_dir=tmp; break;
case 2: m.mnt_type=tmp; break;
case 3: m.mnt_opts=tmp; break;
- case 4: m.mnt_freq=strtol(tmp,&tmp,0); if (*tmp!=' ') continue; break;
+ case 4: m.mnt_freq=strtol(tmp,&tmp,0); if (*tmp!=' ' && *tmp!='\t') continue; break;
case 5: m.mnt_passno=strtol(tmp,&tmp,0); if (*tmp=='\n') return &m; break;
}
- if ((tmp=strchr(tmp,' '))) {
+ while (*tmp && *tmp!=' ' && *tmp!='\n' && *tmp!='\t') ++tmp;
+ if (*tmp) {
if (num<4) *tmp++=0;
- while (*tmp==' ') ++tmp;
+ while (*tmp==' ' || *tmp=='\t') ++tmp;
} else
continue;
}