projects
/
pspp
/ 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 1ff4fefa5ae23bac07c9825eea54eddfe65948e9..4cbc903363fb540057a5ef16f1511c24beefc0db 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 237afde50afe79dfc43627ce9ffe8d14358abc8c..f5507cbcd84ccb6250b76ff0bacb5dfec2a5da97 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;