MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / open_file

Function open_file

src/ntfs_udl.c:820–828  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

818 * n Success, this is the file descriptor
819 */
820static 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

Callers 1

undelete_fileFunction · 0.85

Calls 1

mkdir_local_for_fileFunction · 0.85

Tested by

no test coverage detected