link(2) to rename files in sftp

Markus Friedl markus at openbsd.org
Tue Apr 6 15:45:15 EST 2004


> The original code for rename looked like the following:
>     if (stat(newpath, &st) == -1) {
>         ret = rename(oldpath, newpath);
>         status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
>     }
> 
> The idea is obviously to not clobber existing files, but the 
> implementation is racy (hence the change, I guess).
> 
> I have no idea how to implement that portably for filesystems without 
> Unix semantics without the race.

i think we should
	1) break the specification and just do rename(), or
	2) add a different message type, that just does rename().




More information about the openssh-unix-dev mailing list