]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/pipe.c
fs/pipe.c: preserve alloc_file() error code
[mirror_ubuntu-artful-kernel.git] / fs / pipe.c
index 8865f796370074dbe7a191ab39c9645e80ed481d..997de34644795e34094d6f1f08d060f845a84db1 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -693,17 +693,20 @@ int create_pipe_files(struct file **res, int flags)
 
        d_instantiate(path.dentry, inode);
 
-       err = -ENFILE;
        f = alloc_file(&path, FMODE_WRITE, &pipefifo_fops);
-       if (IS_ERR(f))
+       if (IS_ERR(f)) {
+               err = PTR_ERR(f);
                goto err_dentry;
+       }
 
        f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT));
        f->private_data = inode->i_pipe;
 
        res[0] = alloc_file(&path, FMODE_READ, &pipefifo_fops);
-       if (IS_ERR(res[0]))
+       if (IS_ERR(res[0])) {
+               err = PTR_ERR(res[0]);
                goto err_file;
+       }
 
        path_get(&path);
        res[0]->private_data = inode->i_pipe;