Ripped from Fedora - Fixed AFS support for output redirection, so that the correct errors are reported for other filesystems (bug #155373). https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=155373 --- bash-3.0/redir.c.afs 2005-04-20 09:16:15.000000000 +0100 +++ bash-3.0/redir.c 2005-04-20 09:16:58.000000000 +0100 @@ -596,7 +596,9 @@ fd = open (filename, flags, mode); #if defined (AFS) if ((fd < 0) && (errno == EACCES)) - fd = open (filename, flags & ~O_CREAT, mode); + if ((fd = open (filename, flags & ~O_CREAT, mode)) < 0) + /* Restore previous errno. */ + errno = EACCES; #endif /* AFS */ }