Change 539017 by elliot on 2007/10/01 13:13:47 Fix CLOSE_MNTFILE() return value situation. CLOSE_MNTFILE() was returning void on some platforms and Bool on others. This change makes it always return a Bool as documented in the comments, and then casts CLOSE_MNTFILE() calls to void in places where we don't care about the return value (i.e. all of them). This fixes a compiler warning with gcc 4.2, and brings consistency to the API. ==== lib/syncDriver/syncDriverPosix.c#2 (text) ==== @@ -128,7 +128,7 @@ exit: DynBuf_Destroy(&buf); - CLOSE_MNTFILE(mounts); + (void) CLOSE_MNTFILE(mounts); return paths; } #endif ==== lib/dnd/dndLinux.c#2 (text) ==== @@ -348,7 +348,7 @@ fp = OPEN_MNTFILE("r"); if (fp == NULL) { LOG(1, ("DnD_InitializeBlocking: could not open mount file\n")); - CLOSE_MNTFILE(fp); + (void) CLOSE_MNTFILE(fp); goto out; } @@ -364,7 +364,8 @@ } } - CLOSE_MNTFILE(fp); + (void) CLOSE_MNTFILE(fp); + if (!found) { LOG(4, ("DnD_InitializeBlocking: could not find vmblock mounted\n")); goto out; ==== lib/wiper/wiperPosix.c#2 (text) ==== @@ -455,7 +455,8 @@ } WiperPartitionFilter(p, mnt); - CLOSE_MNTFILE(fp); + (void) CLOSE_MNTFILE(fp); + fp = NULL; return p; @@ -467,7 +468,7 @@ error: SingleWiperPartition_Close(p); if (fp != NULL) { - CLOSE_MNTFILE(fp); + (void) CLOSE_MNTFILE(fp); fp = NULL; } return NULL; @@ -587,7 +588,7 @@ pl->size++; } - CLOSE_MNTFILE(fp); + (void) CLOSE_MNTFILE(fp); fp = NULL; return pl; @@ -596,7 +597,7 @@ WiperPartition_Close(pl); pl = NULL; if (fp != NULL) { - CLOSE_MNTFILE(fp); + (void) CLOSE_MNTFILE(fp); fp = NULL; } return NULL; ==== lib/includes/mntinfo.h#2 (text) ==== @@ -74,7 +74,7 @@ struct mnttab *name = &__ ## name # define OPEN_MNTFILE(mode) fopen(MNTFILE, mode) # define GETNEXT_MNTINFO(fp, mnt) (getmntent(fp, mnt) == 0) -# define CLOSE_MNTFILE(fp) (void) (fclose(fp) == 0) +# define CLOSE_MNTFILE(fp) (fclose(fp) == 0) # define MNTINFO_NAME(mnt) mnt->mnt_special # define MNTINFO_FSTYPE(mnt) mnt->mnt_fstype # define MNTINFO_MNTPT(mnt) mnt->mnt_mountp @@ -132,7 +132,11 @@ boolVal; \ }) -# define CLOSE_MNTFILE(mntHandle) free(mntHandle) +# define CLOSE_MNTFILE(mntHandle) \ +({ \ + free(mntHandle); \ + TRUE; \ +}) # define MNTINFO_NAME(mnt) mnt->f_mntfromname # define MNTINFO_FSTYPE(mnt) mnt->f_fstypename # define MNTINFO_MNTPT(mnt) mnt->f_mntonname