comparison src/fileio.c @ 216:da182deebec7

updated for version 7.0061
author vimboss
date Fri, 18 Mar 2005 20:25:31 +0000
parents 3b32f6b507fa
children 4707450c2b33
comparison
equal deleted inserted replaced
215:a4029d1d83df 216:da182deebec7
3699 * Appending will fail if the file does not exist and forceit is FALSE. 3699 * Appending will fail if the file does not exist and forceit is FALSE.
3700 */ 3700 */
3701 while ((fd = mch_open((char *)wfname, O_WRONLY | O_EXTRA | (append 3701 while ((fd = mch_open((char *)wfname, O_WRONLY | O_EXTRA | (append
3702 ? (forceit ? (O_APPEND | O_CREAT) : O_APPEND) 3702 ? (forceit ? (O_APPEND | O_CREAT) : O_APPEND)
3703 : (O_CREAT | O_TRUNC)) 3703 : (O_CREAT | O_TRUNC))
3704 , perm & 0777)) < 0) 3704 , perm < 0 ? 0666 : (perm & 0777))) < 0)
3705 { 3705 {
3706 /* 3706 /*
3707 * A forced write will try to create a new file if the old one is 3707 * A forced write will try to create a new file if the old one is
3708 * still readonly. This may also happen when the directory is 3708 * still readonly. This may also happen when the directory is
3709 * read-only. In that case the mch_remove() will fail. 3709 * read-only. In that case the mch_remove() will fail.
4267 { 4267 {
4268 int empty_fd; 4268 int empty_fd;
4269 4269
4270 if (org == NULL 4270 if (org == NULL
4271 || (empty_fd = mch_open(org, O_CREAT | O_EXTRA | O_EXCL, 4271 || (empty_fd = mch_open(org, O_CREAT | O_EXTRA | O_EXCL,
4272 perm & 0777)) < 0) 4272 perm < 0 ? 0666 : (perm & 0777))) < 0)
4273 EMSG(_("E206: patchmode: can't touch empty original file")); 4273 EMSG(_("E206: patchmode: can't touch empty original file"));
4274 else 4274 else
4275 close(empty_fd); 4275 close(empty_fd);
4276 } 4276 }
4277 if (org != NULL) 4277 if (org != NULL)