summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2004-05-20 01:06:52 +0000
committerStef Walter <stef@thewalter.net>2004-05-20 01:06:52 +0000
commit77e90afb05ccde00fd59e152c3296f2994d60d6d (patch)
tree212b363d4c0460f6e32e86a68d8fe160a1f4b8f4 /src
parent4297404391e6d828d71306f7402ba1cdd05297aa (diff)
Linux fixes
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/posix.c5
-rw-r--r--src/scrounge.c12
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;