X-Git-Url: http://git.csclub.uwaterloo.ca/?p=kopensolaris-gnu%2Fglibc.git;a=blobdiff_plain;f=misc%2Fmntent_r.c;h=f6ee1ca64e64e74246b2a74ead34b68873d41f08;hp=9567a6f0771e82b8eeab23d11136890f4835d3f7;hb=599139678a58e3c23fef4a55372fb3cb01c31a5a;hpb=d1d1c206d6f1d59f978deaec0de7570e1ac063f2 diff --git a/misc/mntent_r.c b/misc/mntent_r.c index 9567a6f077..f6ee1ca64e 100644 --- a/misc/mntent_r.c +++ b/misc/mntent_r.c @@ -22,6 +22,11 @@ #include #include +#ifdef USE_IN_LIBIO +# define flockfile(s) _IO_flockfile (s) +# define funlockfile(s) _IO_funlockfile (s) +#endif + /* Prepare to begin reading and/or writing mount table entries from the beginning of FILE. MODE is as for `fopen'. */ FILE * @@ -57,7 +62,10 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz) char *end_ptr; if (fgets_unlocked (buffer, bufsiz, stream) == NULL) - return NULL; + { + funlockfile (stream); + return NULL; + } end_ptr = strchr (buffer, '\n'); if (end_ptr != NULL) /* chop newline */ @@ -129,10 +137,11 @@ __hasmntopt (const struct mntent *mnt, const char *opt) while ((p = strstr (rest, opt)) != NULL) { - if (p == rest || p[-1] == ',' && - (p[optlen] == '\0' || - p[optlen] == '=' || - p[optlen] == ',')) + if (p == rest + || (p[-1] == ',' + && (p[optlen] == '\0' || + p[optlen] == '=' || + p[optlen] == ','))) return p; rest = strchr (rest, ',');