Changeset 5187
- Timestamp:
- 01/21/08 09:10:53 (6 months ago)
- Files:
-
- wired/trunk/wired/files.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wired/trunk/wired/files.c
r5166 r5187 1159 1159 file = wi_file_for_updating(commentpath); 1160 1160 1161 if(!file) 1161 if(!file) { 1162 wi_log_warn(WI_STR("Could not open %@: %m"), commentpath); 1163 wd_reply_error(); 1164 1162 1165 return; 1166 } 1163 1167 1164 1168 tmpfile = wi_file_temporary_file(); … … 1166 1170 if(!tmpfile) { 1167 1171 wi_log_warn(WI_STR("Could not create a temporary file: %m")); 1172 wd_reply_error(); 1168 1173 1169 1174 return; … … 1174 1179 name, WD_FILES_COMMENT_FIELD_SEPARATOR, 1175 1180 comment, WD_FILES_COMMENT_SEPARATOR); 1176 1177 1181 comments++; 1178 1182 } … … 1188 1192 } 1189 1193 1190 if(comments > 1) {1194 if(comments > 0) { 1191 1195 wi_file_truncate(file, 0); 1192 1196 wi_file_seek(tmpfile, 0); … … 1194 1198 while((string = wi_file_read(tmpfile, WI_FILE_BUFFER_SIZE))) 1195 1199 wi_file_write(file, WI_STR("%@"), string); 1200 1201 wi_file_close(file); 1202 wi_file_close(tmpfile); 1196 1203 } else { 1197 1204 /* clearing comment, and there are no more comments in the file, remove */
