winecfg/drivedetect.c breaks portability (#include <mntent.h>)

Gerald Pfeifer gerald at pfeifer.com
Wed Nov 24 11:28:06 CST 2004


On Wed, 24 Nov 2004, Gerald Pfeifer wrote:
> The addition of winecfg/drivedetect.c via
> 
>   revision 1.1
>   date: 2004/11/23 13:50:23;  author: julliard;  state: Exp;
>   Mike Hearn <mike at navi.cx>
>   - More heapification.
>   - Split drive code into core, UI and autodetect.
>   - Implement drive autodetection.
>   - Slight redesign of drive tab.
>   - Code cleanup.
> 
> broke FreeBSD 4.10 which does not have <mntent.h>:

Fixed thusly.  Please apply before the next snapshot.

Gerald

ChangeLog:
Fix compilation on systems which do not have <mntent.h>.
Index: drivedetect.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/drivedetect.c,v
retrieving revision 1.1
diff -u -3 -p -r1.1 drivedetect.c
--- drivedetect.c	23 Nov 2004 13:50:23 -0000	1.1
+++ drivedetect.c	24 Nov 2004 18:15:31 -0000
@@ -25,7 +25,9 @@
 #include "winecfg.h"
 
 #include <stdio.h>
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include <stdlib.h>
 #include <errno.h>
 
@@ -38,6 +40,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
 BOOL gui_mode = TRUE;
 static long working_mask = 0;
 
+#ifdef HAVE_MNTENT_H
 static char *ignored_fstypes[] = {
     "devpts",
     "tmpfs",
@@ -79,6 +82,7 @@ static char allocate_letter()
 
     return letter;
 }
+#endif
 
 #define FSTAB_OPEN 1
 #define NO_MORE_LETTERS 2
@@ -182,8 +186,10 @@ static void ensure_drive_c_is_mapped()
 
 int autodetect_drives()
 {
+#ifdef HAVE_MNTENT_H
     struct mntent *ent;
     FILE *fstab;
+#endif
 
     /* we want to build a list of autodetected drives, then ensure each entry
        exists in the users setup. so, we superimpose the autodetected drives
@@ -196,6 +202,7 @@ int autodetect_drives()
 
     working_mask = drive_available_mask('\0');
 
+#ifdef HAVE_MNTENT_H
     fstab = fopen("/etc/fstab", "r");
     if (!fstab)
     {
@@ -243,6 +250,7 @@ int autodetect_drives()
     }
 
     fclose(fstab);
+#endif
 
     ensure_root_is_mapped();
 



More information about the wine-devel mailing list