>From d4f86064bbdd6882d921c9e6c741fce9fc6f646c Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Sun, 17 May 2009 15:48:32 +0530 Subject: [PATCH] libglusterfs: Remove use of GNU extensions Use of GNU extensions was a relic of the past because, this code was copied from glibc. For our purpose, all that was simply , "too much ado for nothing". This also fixed build failures reported for Solaris. --- libglusterfs/src/glusterfs_fstab.c | 18 +++--------------- libglusterfs/src/glusterfs_fstab.h | 4 ---- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/libglusterfs/src/glusterfs_fstab.c b/libglusterfs/src/glusterfs_fstab.c index b21197b..514646e 100644 --- a/libglusterfs/src/glusterfs_fstab.c +++ b/libglusterfs/src/glusterfs_fstab.c @@ -20,7 +20,6 @@ #include #include -#include #include #include #include "glusterfs_fstab.h" @@ -32,20 +31,12 @@ glusterfs_fstab_t * glusterfs_fstab_init (const char *file, const char *mode) { glusterfs_fstab_t *handle = NULL; - /* Extend the mode parameter with "c" to disable cancellation in the - I/O functions. */ - size_t modelen = strlen (mode); - char newmode[modelen + 2]; - memcpy (mempcpy (newmode, mode, modelen), "c", 2); - handle = calloc (1, sizeof (glusterfs_fstab_t)); if (!handle) goto out; - FILE *result = fopen (file, newmode); + FILE *result = fopen (file, mode); if (result != NULL) { - /* We do the locking ourselves. */ - __fsetlocking (result, FSETLOCKING_BYCALLER); handle->fp = result; } else { free (handle); @@ -128,14 +119,12 @@ __glusterfs_fstab_getent (FILE *stream, struct glusterfs_mntent *mp, char *cp; char *head; - flockfile (stream); do { char *end_ptr; - if (fgets_unlocked (buffer, bufsiz, stream) == NULL) + if (fgets (buffer, bufsiz, stream) == NULL) { - funlockfile (stream); return NULL; } @@ -146,7 +135,7 @@ __glusterfs_fstab_getent (FILE *stream, struct glusterfs_mntent *mp, { /* Not the whole line was read. Do it now but forget it. */ char tmp[1024]; - while (fgets_unlocked (tmp, sizeof tmp, stream) != NULL) + while (fgets (tmp, sizeof tmp, stream) != NULL) if (strchr (tmp, '\n') != NULL) break; } @@ -179,7 +168,6 @@ __glusterfs_fstab_getent (FILE *stream, struct glusterfs_mntent *mp, case 2: break; } - funlockfile (stream); return mp; } diff --git a/libglusterfs/src/glusterfs_fstab.h b/libglusterfs/src/glusterfs_fstab.h index 5d6c6a7..831ae7c 100644 --- a/libglusterfs/src/glusterfs_fstab.h +++ b/libglusterfs/src/glusterfs_fstab.h @@ -20,10 +20,6 @@ #ifndef GLUSTERFS_FSTAB_MNTENT_H #define GLUSTERFS_FSTAB_MNTENT_H 1 -#include -#include -#include - /* General filesystem types. */ #define GF_MNTTYPE_IGNORE "ignore" /* Ignore this entry. */ -- 1.6.2.1