lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <BFF42091-C65E-49FE-826A-91E181354E2F@iki.fi>
Date:	Sat, 7 Apr 2007 18:15:57 +0300
From:	Timo Sirainen <tss@....fi>
To:	linux-kernel@...r.kernel.org
Subject: O_APPEND, lseek() and pwrite()

If I open a file with O_APPEND and write() to it, it looks like the  
file offset is updated and I can get it with lseek(SEEK_CUR). Can I  
trust that this behavior won't change in future Linux versions?  
Apparently this isn't standard, because at least OS X and Solaris  
don't do this.

pwrite() ignores the file offset if the fd has O_APPEND set (with  
2.6.20). http://www.opengroup.org/austin/mailarchives/ag/ 
msg09453.html suggests that it shouldn't ignore it. Could this be  
changed? For now I can of course just change the flag with fcntl().

I guess there aren't any limits to how large blocks write() accepts  
without the data being mixed with another process's writes (both with  
O_APPEND)? And I guess there aren't any horrible performance problems  
with this, so that this is actually a good idea compared to file lock  
+ write() + unlock? :)


Download attachment "PGP.sig" of type "application/pgp-signature" (187 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ