Re: fsync on large files

Mitchell Blank Jr (mitch@execpc.com)
Mon, 22 Feb 1999 22:53:32 -0600


Wayne Schlitt wrote:
> The V7 mkdir(1) command was a suid binary that did the mknod()'s and
> the link()'s for "." and "..".

Yes

> You could royally screw up your file system with the ln command as
> root, I don't even recall if ln checked for directories or if you had
> to add a flag to force it.

I don't think that's true... ln(1) doesn't seem to touch directories, nor
does there seem to be an obvious flag (nor is one documented in the man
page). UID 0 could call link(2) on a directory, though:

# mkdir a
# ls -ld a
drwxrwxr-x 2 root other 32 Dec 25 00:59 a
# ln a b
ln: a is a directory
# echo 'main() { link("a","b"); } ' > l.c
# cc l.c -o l
# ./l
# ls -ld a b
drwxrwxr-x 3 root other 32 Dec 25 01:05 a
drwxrwxr-x 3 root other 32 Dec 25 01:05 b
# ls -lia a b

a:
total 2
541 drwxrwxr-x 3 root other 32 Dec 25 01:05 .
276 drwxrwxrwx 3 bin bin 240 Dec 25 01:06 ..

b:
total 2
541 drwxrwxr-x 3 root other 32 Dec 25 01:05 .
276 drwxrwxrwx 3 bin bin 240 Dec 25 01:06 ..

-Mitch

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/