diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/posix.c | 5 | ||||
-rw-r--r-- | src/scrounge.c | 12 |
3 files changed, 12 insertions, 7 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index be563f5..bf70535 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = scrounge-ntfs +sbin_PROGRAMS = scrounge-ntfs scrounge_ntfs_SOURCES = compat.c compat.h debug.h drive.h list.c locks.h main.c memref.h \ misc.c ntfs.c ntfs.h ntfsx.h ntfsx.c posix.c scrounge.c scrounge.h \ diff --git a/src/posix.c b/src/posix.c index 91bb43a..14a9a2d 100644 --- a/src/posix.c +++ b/src/posix.c @@ -94,7 +94,10 @@ void setFileAttributes(fchar_t* filename, uint32 flags) } else { - if(chmod(filename, st.st_mode & ~(S_IWUSR | S_IWGRP | S_IWOTH)) == -1) + st.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH); + fprintf(stderr, "mode: %x", st.st_mode); + + if(chmod(filename, st.st_mode) == -1) warn("couldn't set file attributes for: " FC_PRINTF, encoded); } } diff --git a/src/scrounge.c b/src/scrounge.c index 45cd1bf..66b608e 100644 --- a/src/scrounge.c +++ b/src/scrounge.c @@ -24,6 +24,8 @@ #include "locks.h" #define PROCESS_MFT_FLAG_SUB 1 << 1 +#define DEF_FILE_MODE 0x180 +#define DEF_DIR_MODE 0x1C0 typedef struct _filebasics { @@ -212,7 +214,7 @@ void processMFTRecord(partitioninfo* pi, uint64 sector, uint32 flags) if(!g_verifyMode) #endif { - if(fc_mkdir(basics.filename) == -1) + if(fc_mkdir(basics.filename, DEF_DIR_MODE) == -1) { warn("couldn't create directory '" FC_PRINTF "' putting files in parent directory", basics.filename); } @@ -244,7 +246,7 @@ void processMFTRecord(partitioninfo* pi, uint64 sector, uint32 flags) else #endif { - ofile = fc_open(basics.filename, O_BINARY | O_CREAT | O_EXCL | O_WRONLY); + ofile = fc_open(basics.filename, O_BINARY | O_CREAT | O_EXCL | O_WRONLY, DEF_FILE_MODE); fcsncpy(filename2, basics.filename, MAX_PATH); filename2[MAX_PATH] = 0; @@ -263,7 +265,7 @@ void processMFTRecord(partitioninfo* pi, uint64 sector, uint32 flags) itofc(rename, basics.filename + fcslen(basics.filename), 10); rename++; - ofile = fc_open(basics.filename, O_BINARY | O_CREAT | O_EXCL | O_WRONLY); + ofile = fc_open(basics.filename, O_BINARY | O_CREAT | O_EXCL | O_WRONLY, DEF_FILE_MODE); } if(ofile == -1) @@ -559,8 +561,8 @@ void scroungeUsingMFT(partitioninfo* pi) void scroungeUsingRaw(partitioninfo* pi) { - byte buffSec[kSectorSize]; - fchar_t dir[MAX_PATH + 1]; + byte buffSec[kSectorSize]; + fchar_t dir[MAX_PATH + 1]; uint64 sec; drivelocks locks; int64 pos; |