delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/12/20/16:25:53

From: Alain Magloire <alainm AT rcsm DOT ece DOT mcgill DOT ca>
Message-Id: <199912202105.QAA27916@mccoy2.ECE.McGill.CA>
Subject: Re: The 5th symlink patch
To: djgpp-workers AT delorie DOT com
Date: Mon, 20 Dec 1999 16:05:09 -0500 (EST)
In-Reply-To: <385B321C.4A6FC82@softhome.net> from "Laurynas Biveinis" at Dec 18, 99 09:05:00 am
X-Mailer: ELM [version 2.4 PL25]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Bonjour M. Laurynas Biveinis

> Alain Magloire wrote:
> > I did not follow your discussion, but some functions that comes to mind
> > lstat()
> > lchown()
> > symlink()
> > readlink()
> 
> All those functions are implemented.
> 
> > link() unlink() // hard links
> 
> Hard links are emulated in DJGPP by copying.
> My implementation does not deal with them at
> all.
> 
> > Are you detecting loops ? and returning ELOOP
> 
> I am detecting too many link levels and returning
> EMLINK. This catches loops too.

Posix does nto define symlink, IIRC.
But it should be in Unix98 or whatever new version they have.

[ELOOP] Too many symbolic links were encountered in resolving path. 
[EMLINK] The link count of the parent directory would exceed {LINK_MAX}. 

Again I did not follow the thread and my understand of DOS is to minimal
to do any sane comments on your work.

On a solaris mahine loops return ELOOP, EMLINK is return by mkdir ().

# uname -rs
SunOS 5.6
# mkdir A B
# cd A
# ln -s ../B/b a
# cd ../B
# ln -s ../A/a b
# cat m.c
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>

int
main (int argc, char **argv)
{
	int fd;

	errno = 0;

	fd = open (argv[1], O_RDONLY);

	fprintf (stderr, "%d %s\n", errno, strerror(errno));
	return 0;
}
# cc -o m m.c
# m b
./m b
90 Number of symbolic links encountered during path name traversal
   exceeds MAXSYMLINKS
# grep ELOOP /usr/include/sys/errno.h
#define ELOOP   90      /* Symbolic link loop                   */


--
alain

- Raw text -


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