Skip to contentSkip to conversation

futimes()?

DISCUSSION H. Peter Anvin 3 participants 4 messages Feb 2, 2003 – Feb 3, 2003

lore
Share & tools
lore
#0 lore raw

In the general vein of avoiding security holes by using file descriptors when doing repeated operations on the same filesystem object, I have noticed that there doesn't seem to be a way to set mtime using a file descriptor. Do we need a futimes() syscall?

-hpa

Signature · 3 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: cris ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64
#1 lore raw
Quoted 5 lines · H. Peter Anvin

In the general vein of avoiding security holes by using file descriptors when doing repeated operations on the same filesystem object, I have noticed that there doesn't seem to be a way to set mtime using a file descriptor. Do we need a futimes() syscall?

Parallel to that, there is the long time needed lutimes() syscall.

Who has never been annoyed that restoring a backup there's no way to restore former symlink mtime?

Signature · 5 lines
Abramo Bagnara                       mailto:[email protected]

Opera Unica                          Phone: +39.546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy
#2 lore raw
In reply to H. Peter Anvin

H. Peter Anvin, Sun, Feb 02, 2003 02:53:22 +0100:

Quoted 4 lines

In the general vein of avoiding security holes by using file descriptors when doing repeated operations on the same filesystem object, I have noticed that there doesn't seem to be a way to set mtime using a file descriptor. Do we need a futimes() syscall?

There is a small problem with close(). It can update mtime as well.

#3 lore raw
Followup to:  <[email protected]>
By author:    Alex Riesen <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 9 lines

H. Peter Anvin, Sun, Feb 02, 2003 02:53:22 +0100:

Quoted 4 lines

In the general vein of avoiding security holes by using file descriptors when doing repeated operations on the same filesystem object, I have noticed that there doesn't seem to be a way to set mtime using a file descriptor. Do we need a futimes() syscall?

There is a small problem with close(). It can update mtime as well.

Presumably it shouldn't unless the file descriptor has been written to since the last fsync().

-hpa

Signature · 3 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: cris ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64