This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: rpm and chroot


To the people who were working on getting rpm to work.  I was just up late
thinging, here's an idea (which I can't try as gnu-win32 isn't working for
me right now).

In the main file (I'm guessing main.c), make a global variable (say 
rootdir) char rootdir[1023]="/" (last I checked maximum path length in
FreeBSD was 1023, over that and it will return ENAMETOOLONG.

In another file say chroot.c

/* incorporate snprintf from other locations as it's not in cygwin.dll I 
think */

extern char rootdir;
int chroot(char *rootpath)
{
/* preform error checking here
return -1 if it's invalid and set errno */
strncpy(rootdir,1023,"%s",rootpath);
}

FILE *rpm_fopen(char *path, char *mode)
{
char fullpath[1023];
if path[0] == '/'
snprintf(fullpath,1023,"%s%s",rootdir,path);
else
snprintf(fullpath,1023,"%s",path);
return fopen(fullpath,mode);
}

or something similar.

Then change all references to fopen, etc, etc to rpm_*.  A really ugly
kludge but that should allow you to work around chroot if I'm not leaving
out something really obvious.

- alex

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]