This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: rpm and chroot
- To: gnu-win32 at cygnus dot com
- Subject: Re: rpm and chroot
- From: Alex <garbanzo at hooked dot net>
- Date: Sat, 20 Sep 1997 23:19:53 -0700 (PDT)
- Reply-To: Alex <garbanzo at hooked dot net>
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".