projects
/
gnulib.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1d94e29
)
Don't call ftruncate() when it's not needed.
author
Bruno Haible
<bruno@clisp.org>
Tue, 31 Dec 2002 13:02:48 +0000
(13:02 +0000)
committer
Bruno Haible
<bruno@clisp.org>
Tue, 31 Dec 2002 13:02:48 +0000
(13:02 +0000)
lib/ChangeLog
patch
|
blob
|
history
lib/utime.c
patch
|
blob
|
history
diff --git
a/lib/ChangeLog
b/lib/ChangeLog
index
1ff4fef
..
4cbc903
100644
(file)
--- a/
lib/ChangeLog
+++ b/
lib/ChangeLog
@@
-1,3
+1,8
@@
+2002-12-22 Bruno Haible <bruno@clisp.org>
+
+ * utime.c (utime_null): No need to call ftruncate if the file was
+ nonempty.
+
2002-12-23 Bruno Haible <bruno@clisp.org>
* memcoll.c (STRCOLL): New macro.
diff --git
a/lib/utime.c
b/lib/utime.c
index
237afde
..
f5507cb
100644
(file)
--- a/
lib/utime.c
+++ b/
lib/utime.c
@@
-65,7
+65,7
@@
utime_null (const char *file)
of patches, but that system doesn't use this code: it has utimes.
|| fsync (fd) < 0
*/
- ||
ftruncate (fd, st.st_size) < 0
+ ||
(st.st_size == 0 && ftruncate (fd, st.st_size) < 0)
|| close (fd) < 0)
status = -1;
return status;