9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* ftpfs change to compensate for some servers
@ 1995-11-09 20:02 forsyth
  0 siblings, 0 replies; 3+ messages in thread
From: forsyth @ 1995-11-09 20:02 UTC (permalink / raw)



some FTP servers include . and .. in the list, which messes up
common commands applied to a mounted ftpfs directory.
the following change prevents them from being seen:

vortex% diff $home/cd/cmd/ftpfs /sys/src/cmd/ftpfs/proto.c
38a39
> static int	isdotdot(char*);
670a672,673
> 			if(isdotdot(field[7]))
> 				return 0;
681a685,686
> 			if(isdotdot(field[8]))
> 				return 0;
692a698,699
> 			if(isdotdot(field[9]))
> 				return 0;
703a711,712
> 			if(isdotdot(field[0]))
> 				return 0;
721a731,736
> }
> 
> static int
> isdotdot(char *n)
> {
> 	return n[0]=='.' && (n[1]=='\0' || n[1]=='.' && n[2]=='\0');






^ permalink raw reply	[flat|nested] 3+ messages in thread

* ftpfs change to compensate for some servers
@ 1995-11-10 16:16 forsyth
  0 siblings, 0 replies; 3+ messages in thread
From: forsyth @ 1995-11-10 16:16 UTC (permalink / raw)


>>I think this is easier and more correct since it covers all systems, not
>>just Unix-like:

i agree.  if a non-Unix system ever decided to
use . or .. as a file name, it would have to
be mapped to something else anyhow.







^ permalink raw reply	[flat|nested] 3+ messages in thread

* ftpfs change to compensate for some servers
@ 1995-11-10  8:58 presotto
  0 siblings, 0 replies; 3+ messages in thread
From: presotto @ 1995-11-10  8:58 UTC (permalink / raw)


	some FTP servers include . and .. in the list, which messes up
	common commands applied to a mounted ftpfs directory.
	the following change prevents them from being seen:

	vortex% diff $home/cd/cmd/ftpfs /sys/src/cmd/ftpfs/proto.c
	38a39
	> static int	isdotdot(char*);
	670a672,673
	> 			if(isdotdot(field[7]))
	> 				return 0;
	681a685,686
	> 			if(isdotdot(field[8]))
	> 				return 0;
	692a698,699
	> 			if(isdotdot(field[9]))
	> 				return 0;
	703a711,712
	> 			if(isdotdot(field[0]))
	> 				return 0;
	721a731,736
	> }
	> 
	> static int
	> isdotdot(char *n)
	> {
	> 	return n[0]=='.' && (n[1]=='\0' || n[1]=='.' && n[2]=='\0');

I think this is easier and more correct since it covers all systems, not
just Unix-like:

	at the end of the switch statement of crackdir(), before
	line 714, add

	if(strcmp(longname, ".") == 0 || strcmp(longname, "..") == 0)
		return 0;

or, if the strcmp's bug you, use forsyth's isdotdot().






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1995-11-10 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-11-09 20:02 ftpfs change to compensate for some servers forsyth
1995-11-10  8:58 presotto
1995-11-10 16:16 forsyth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).