* open_file - Open a file to write to * @pathname: Path, name and stream of the file to open * * Create a file and return the file descriptor. * * Existing file will be overwritten. * * Return: -1 Error, failed to create the file * n Success, this is the file descriptor */
| 818 | * n Success, this is the file descriptor |
| 819 | */ |
| 820 | static int open_file(const char *pathname) |
| 821 | { |
| 822 | int fh; |
| 823 | fh=open(pathname, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); |
| 824 | if(fh != -1 || errno!=ENOENT) |
| 825 | return fh; |
| 826 | mkdir_local_for_file(pathname); |
| 827 | return open(pathname, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); |
| 828 | } |
| 829 | |
| 830 | /** |
| 831 | * undelete_file - Recover a deleted file from an NTFS volume |
no test coverage detected