delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/09/20/23:55:59

From: garbanzo AT hooked DOT net (Alex)
Subject: Re: rpm and chroot
20 Sep 1997 23:55:59 -0700 :
Message-ID: <Pine.BSF.3.96.970920231208.1023B-100000.cygnus.gnu-win32@zippy.dyn.ml.org>
Reply-To: Alex <garbanzo AT hooked DOT net>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019