X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=file_write.c;h=0cee535aa92ff9b5aaba1b815c8e8c95e0dd4731;hp=b12d07d5fbc8c71df0584bbf67b0bf7dc2d80ea6;hb=6b935f552ebfe3a0a83ec9367deb2f42c1aff252;hpb=70ee2199d293268fac6453a8ec6b3b39d2553f7b diff --git a/file_write.c b/file_write.c index b12d07d5..0cee535a 100644 --- a/file_write.c +++ b/file_write.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2009 Andre Noll + * Copyright (C) 2006-2010 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -56,19 +56,26 @@ static int file_write_open(struct writer_node *wn) sizeof(struct private_file_write_data)); struct file_write_args_info *conf = wn->conf; char *filename; + int ret; if (conf->filename_given) filename = conf->filename_arg; else filename = random_filename(); wn->private_data = pfwd; - pfwd->fd = open(filename, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); + ret = para_open(filename, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); if (!conf->filename_given) free(filename); - if (pfwd->fd >= 0) + if (ret < 0) + goto out; + pfwd->fd = ret; + ret = mark_fd_blocking(pfwd->fd); + if (ret >= 0) return 1; + close(pfwd->fd); +out: free(pfwd); - return -E_FW_OPEN; + return ret; } static void file_write_pre_select(struct sched *s, struct task *t)