On Wed, Jul 14, 1999 at 12:58:27PM +1100, Brian Salter-Duke wrote:
> >AIX 3.2.5 doesn't have fchdir(2).
> >
> >Try replacing
> >
> > if (fchdir(fdsourcedir) == -1)
> >
> >with
> > if (chdir(".") == -1)
Looks like my (broken) suggestion a few years back (mine was a 3.2.4 system).
Please try the following patch and let me know whether it works for you.
# diff -u install.c.orig install.c
--- install.c.orig Wed Jul 14 11:02:55 1999
+++ install.c Wed Jul 14 11:08:15 1999
@@ -1,3 +1,5 @@
+#include <sys/param.h>
+
#include "substdio.h"
#include "strerr.h"
#include "error.h"
@@ -10,6 +12,7 @@
#define FATAL "install: fatal: "
int fdsourcedir = -1;
+char sourcedir[MAXPATHLEN+1];
void h(home,uid,gid,mode)
char *home;
@@ -78,7 +81,7 @@
int fdin;
int fdout;
- if (fchdir(fdsourcedir) == -1)
+ if (chdir(sourcedir) == -1)
strerr_die2sys(111,FATAL,"unable to switch back to source directory: ");
fdin = open_read(file);
@@ -157,6 +160,11 @@
fdsourcedir = open_read(".");
if (fdsourcedir == -1)
strerr_die2sys(111,FATAL,"unable to open current directory: ");
+
+ getcwd(sourcedir,MAXPATHLEN);
+ if (sourcedir == (char *)0)
+ strerr_die2sys(111,FATAL,"unable to open current directory: ");
+
umask(077);
hier();
Btw, the FreeBSD getcwd(3) manpage says:
These routines have traditionally been used by programs to save the name
of a working directory for the purpose of returning to it. A much faster
and less error-prone method of accomplishing this is to open the current
directory (`.') and use the fchdir(2) function to return.
AIX 4.x does have fchdir(2).
Cheers,
--
Jos Backus _/ _/_/_/ "Reliability means never
_/ _/ _/ having to say you're sorry."
_/ _/_/_/ -- D. J. Bernstein
_/ _/ _/ _/
[EMAIL PROTECTED] _/_/ _/_/_/ use Std::Disclaimer;