This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: [maybe-ITP] gamin
- From: "Yaakov S (Cygwin Ports)" <yselkowitz at users dot sourceforge dot net>
- To: cygwin-apps at cygwin dot com
- Date: Wed, 01 Feb 2006 20:22:26 -0600
- Subject: Re: [maybe-ITP] gamin
- References: <43D804B8.5010707@lapo.it> <20060125233034.GB19455@trixie.casa.cgf.cx> <43D81994.8020403@users.sourceforge.net> <43D8FDA4.2010409@lapo.it> <43D9426E.3080106@users.sourceforge.net> <43D955BF.8090102@users.sourceforge.net> <43DE244C.2030402@lapo.it> <43DEB2E4.2020106@users.sourceforge.net> <Pine.GSO.4.63.0601302011170.2628@access1.cims.nyu.edu> <43DECBA1.1030508@users.sourceforge.net> <43DF2F7F.7050203@lapo.it>
Lapo Luchini wrote:
Yes, probably checking dinamically if the disk is FAT and ignore
permission issues in that case is the best solution.
How about this; gamin_check_not_fat() can be an additional condition to
the "wrong permissions" errors.
(Believe it or not, my C programming isn't that strong. So please check
this over, although this was mostly borrowed from Corinna.)
#ifdef __CYGWIN__
/* Code adapted from Corinna Vinschen's getvolumeinfo.c:
http://www.cygwin.com/ml/cygwin/2006-01/msg00818.html */
#include <stdio.h>
#include <string.h>
#include <sys/cygwin.h>
#define _WIN32_WINNT 0x0500
#include <windows.h>
#ifndef FILE_READ_ONLY_VOLUME
#define FILE_READ_ONLY_VOLUME 0x80000
#endif
#endif /* __CYGWIN__ */
/**
* gamin_check_not_fat:
*
* On Cygwin, check if socket dir is on not a FAT drive. This is
* necessary because gamin_check_secure_{dir,path} check permissions,
* and FAT drives do not have a permissions model; everything is 755.
*
* On other platforms, we assume that the socket dir is not on FAT.
*
* Returns 1 if NOT on a FAT drive, 0 if on FAT, -1 in case of error.
*/
static int
gamin_check_not_fat (void)
{
#ifdef __CYGWIN__
const char *cygpath;
char winpath[256];
char rootdir[256];
char volname[256];
char fsname[256];
DWORD sernum = 0;
DWORD maxlen = 0;
DWORD flags = 0;
cygpath = gamin_get_socket_dir();
cygwin_conv_to_full_win32_path (cygpath, winpath);
if (!GetVolumePathName(winpath, rootdir, 256))
{
fprintf (stderr, "GetVolumePathName: %d\n", GetLastError ());
return -1;
}
if (!GetVolumeInformation (rootdir, volname, 256, &sernum,
&maxlen, &flags, fsname, 256))
{
fprintf (stderr, "GetVolumeInformation: %d\n", GetLastError ());
return -1;
}
if (strcmp(fsname, "FAT") == 0)
{
return 0;
}
#endif /* __CYGWIN__ */
return 1;
}
If you mean "no one else will do that for you" I do perfectly agree, my
message was maybe a bit unclear about that, but I wasn't asking anyone
actually ;-)
Exactly.
Alex already ported the patches to 0.1.7 but it seems that 0.1.7 breaks
polling itself, probably because there are no more linuxes without
dnotify or inotify around, so the author didn't notice. We are
investigating this problem, anyway.
And it looks like FreeBSD has yet to figure it out themselves either, so
at least we have good company. :-)
Yaakov