summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2012-11-06 09:46:08 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2012-11-06 09:46:08 +0100
commit34da5767b6235158fe1d1e2a784a40dbb590f9db (patch)
tree6cb89049881d951c3adeb4e87edabdf75a5f6d56 /src
parent7d15a16cb83c2719f136785898ed3c6dd415f824 (diff)
Don't depend on "struct stat" for storing information about files, this
fix inode truncation when compiled with cygwin
Diffstat (limited to 'src')
-rw-r--r--src/askloc.c41
-rw-r--r--src/dir.c44
-rw-r--r--src/dir.h24
-rw-r--r--src/dirn.c40
-rw-r--r--src/exfat_dir.c54
-rw-r--r--src/ext2_dir.c38
-rw-r--r--src/fat_adv.c34
-rw-r--r--src/fat_dir.c42
-rw-r--r--src/fat_unformat.c32
-rw-r--r--src/ntfs_dir.c43
-rw-r--r--src/ntfs_udl.c49
-rw-r--r--src/rfs_dir.c19
12 files changed, 184 insertions, 276 deletions
diff --git a/src/askloc.c b/src/askloc.c
index 8ea15c1..860f52a 100644
--- a/src/askloc.c
+++ b/src/askloc.c
@@ -116,7 +116,7 @@ void get_dos_drive_list(struct td_list_head *list)
new_drive=(file_info_t*)MALLOC(sizeof(*new_drive));
new_drive->name=(char*)MALLOC(4);
sprintf(new_drive->name, "%c:/", i);
- new_drive->stat.st_mode=LINUX_S_IFDIR|LINUX_S_IRWXUGO;
+ new_drive->st_mode=LINUX_S_IFDIR|LINUX_S_IRWXUGO;
td_list_add_tail(&new_drive->list, list);
}
}
@@ -236,6 +236,7 @@ char *ask_location(const char*msg, const char *src_dir, const char *dst_org)
#endif
)
{
+ struct stat file_stat;
strcpy(current_file,dst_directory);
#if defined(DJGPP) || defined(__OS2__)
if(current_file[0]!='\0'&&current_file[1]!='\0'&&current_file[2]!='\0'&&current_file[3]!='\0')
@@ -245,26 +246,34 @@ char *ask_location(const char*msg, const char *src_dir, const char *dst_org)
strcat(current_file,SPATH_SEP);
strcat(current_file,dir_entrie->d_name);
#ifdef HAVE_LSTAT
- if(lstat(current_file,&file_info->stat)==0)
+ if(lstat(current_file,&file_stat)==0)
#else
- if(stat(current_file,&file_info->stat)==0)
+ if(stat(current_file,&file_stat)==0)
#endif
{
+ file_info->st_ino=file_stat.st_ino;
+ file_info->st_mode=file_stat.st_mode;
+ file_info->st_uid=file_stat.st_uid;
+ file_info->st_gid=file_stat.st_gid;
+ file_info->st_size=file_stat.st_size;
+ file_info->td_atime=file_stat.st_atime;
+ file_info->td_mtime=file_stat.st_mtime;
+ file_info->td_ctime=file_stat.st_ctime;
#if defined(DJGPP) || defined(__OS2__)
/* If the C library doesn't use posix definition, st_mode need to be fixed */
- if(S_ISDIR(file_info->stat.st_mode))
- file_info->stat.st_mode=LINUX_S_IFDIR|LINUX_S_IRWXUGO;
+ if(S_ISDIR(file_info->st_mode))
+ file_info->st_mode=LINUX_S_IFDIR|LINUX_S_IRWXUGO;
else
- file_info->stat.st_mode=LINUX_S_IFREG|LINUX_S_IRWXUGO;
+ file_info->st_mode=LINUX_S_IFREG|LINUX_S_IRWXUGO;
#endif
#ifdef __CYGWIN__
/* Fix Drive list */
if(memcmp(dst_directory, "/cygdrive", 9)==0 && (dst_directory[10]=='\0' || dst_directory[11]=='\0'))
{
- file_info->stat.st_mode=LINUX_S_IFDIR|LINUX_S_IRWXUGO;
- file_info->stat.st_mtime=0;
- file_info->stat.st_uid=0;
- file_info->stat.st_gid=0;
+ file_info->st_mode=LINUX_S_IFDIR|LINUX_S_IRWXUGO;
+ file_info->td_mtime=0;
+ file_info->st_uid=0;
+ file_info->st_gid=0;
}
#endif
file_info->name=strdup(dir_entrie->d_name);
@@ -499,7 +508,7 @@ char *ask_location(const char*msg, const char *src_dir, const char *dst_org)
file_info_t *file_info;
file_info=td_list_entry(current_file, file_info_t, list);
if(current_file!=&dir_list.list &&
- (LINUX_S_ISDIR(file_info->stat.st_mode) || LINUX_S_ISLNK(file_info->stat.st_mode)))
+ (LINUX_S_ISDIR(file_info->st_mode) || LINUX_S_ISLNK(file_info->st_mode)))
if(current_file!=&dir_list.list)
{
if(strcmp(file_info->name, ".")==0)
@@ -552,9 +561,9 @@ static void dir_aff_entry(WINDOW *window, file_info_t *file_info)
{
char str[11];
char datestr[80];
- if(file_info->stat.st_mtime!=0)
+ if(file_info->td_mtime!=0)
{
- const struct tm *tm_p= localtime(&file_info->stat.st_mtime);
+ const struct tm *tm_p= localtime(&file_info->td_mtime);
snprintf(datestr, sizeof(datestr),"%2d-%s-%4d %02d:%02d",
tm_p->tm_mday, monstr[tm_p->tm_mon],
1900 + tm_p->tm_year, tm_p->tm_hour,
@@ -563,10 +572,10 @@ static void dir_aff_entry(WINDOW *window, file_info_t *file_info)
} else {
strncpy(datestr, " ",sizeof(datestr));
}
- mode_string(file_info->stat.st_mode,str);
+ mode_string(file_info->st_mode, str);
wprintw(window, "%s %5u %5u ",
- str, (unsigned int)file_info->stat.st_uid, (unsigned int)file_info->stat.st_gid);
- wprintw(window, "%9llu", (long long unsigned int)file_info->stat.st_size);
+ str, (unsigned int)file_info->st_uid, (unsigned int)file_info->st_gid);
+ wprintw(window, "%9llu", (long long unsigned int)file_info->st_size);
/* screen may overlap due to long filename */
wprintw(window, " %s %s", datestr, file_info->name);
}
diff --git a/src/dir.c b/src/dir.c
index b46de5f..00e1e9c 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -161,10 +161,10 @@ int dir_aff_log(const dir_data_t *dir_data, const file_data_t*dir_list)
{
char datestr[80];
char str[11];
- if(current_file->stat.st_mtime)
+ if(current_file->td_mtime)
{
struct tm *tm_p;
- tm_p = localtime(&current_file->stat.st_mtime);
+ tm_p = localtime(&current_file->td_mtime);
snprintf(datestr, sizeof(datestr),"%2d-%s-%4d %02d:%02d",
tm_p->tm_mday, monstr[tm_p->tm_mon],
1900 + tm_p->tm_year, tm_p->tm_hour,
@@ -177,21 +177,17 @@ int dir_aff_log(const dir_data_t *dir_data, const file_data_t*dir_list)
} else {
strncpy(datestr, " ",sizeof(datestr));
}
- mode_string(current_file->stat.st_mode,str);
+ mode_string(current_file->st_mode, str);
if((current_file->status&FILE_STATUS_DELETED)!=0)
log_info("X");
else
log_info(" ");
log_info("%7lu %s %5u %5u %9llu %s ",
- (unsigned long int)current_file->stat.st_ino,
+ (unsigned long int)current_file->st_ino,
str,
- (unsigned int)current_file->stat.st_uid,
- (unsigned int)current_file->stat.st_gid,
-#ifdef DJGPP
- (long long unsigned int)current_file->file_size,
-#else
- (long long unsigned int)current_file->stat.st_size,
-#endif
+ (unsigned int)current_file->st_uid,
+ (unsigned int)current_file->st_gid,
+ (long long unsigned int)current_file->st_size,
datestr);
if(dir_data!=NULL && (dir_data->param&FLAG_LIST_PATHNAME)!=0)
{
@@ -224,10 +220,10 @@ int log_list_file(const disk_t *disk, const partition_t *partition, const dir_da
log_info("X");
else
log_info(" ");
- if(current_file->stat.st_mtime)
+ if(current_file->td_mtime)
{
struct tm *tm_p;
- tm_p = localtime(&current_file->stat.st_mtime);
+ tm_p = localtime(&current_file->td_mtime);
snprintf(datestr, sizeof(datestr),"%2d-%s-%4d %02d:%02d",
tm_p->tm_mday, monstr[tm_p->tm_mon],
@@ -241,15 +237,11 @@ int log_list_file(const disk_t *disk, const partition_t *partition, const dir_da
} else {
strncpy(datestr, " ",sizeof(datestr));
}
- mode_string(current_file->stat.st_mode,str);
- log_info("%7lu ",(unsigned long int)current_file->stat.st_ino);
+ mode_string(current_file->st_mode, str);
+ log_info("%7lu ",(unsigned long int)current_file->st_ino);
log_info("%s %5u %5u ",
- str, (unsigned int)current_file->stat.st_uid, (unsigned int)current_file->stat.st_gid);
-#ifdef DJGPP
- log_info("%9llu", (long long unsigned int)current_file->file_size);
-#else
- log_info("%9llu", (long long unsigned int)current_file->stat.st_size);
-#endif
+ str, (unsigned int)current_file->st_uid, (unsigned int)current_file->st_gid);
+ log_info("%9llu", (long long unsigned int)current_file->st_size);
log_info(" %s %s\n", datestr, current_file->name);
}
return test_date;
@@ -301,9 +293,9 @@ static int dir_whole_partition_log_aux(disk_t *disk, const partition_t *partitio
inode_known[dir_nbr++]=inode;
for(current_file=dir_list;current_file!=NULL;current_file=current_file->next)
{
- if(LINUX_S_ISDIR(current_file->stat.st_mode)!=0)
+ if(LINUX_S_ISDIR(current_file->st_mode)!=0)
{
- const unsigned long int new_inode=current_file->stat.st_ino;
+ const unsigned long int new_inode=current_file->st_ino;
unsigned int new_inode_ok=1;
unsigned int i;
if(new_inode<2)
@@ -343,13 +335,13 @@ int filesort(const struct td_list_head *a, const struct td_list_head *b)
const file_info_t *file_a=td_list_entry_const(a, const file_info_t, list);
const file_info_t *file_b=td_list_entry_const(b, const file_info_t, list);
/* Directories must be listed before files */
- const int res=((file_b->stat.st_mode&LINUX_S_IFDIR)-(file_a->stat.st_mode&LINUX_S_IFDIR));
+ const int res=((file_b->st_mode&LINUX_S_IFDIR)-(file_a->st_mode&LINUX_S_IFDIR));
if(res)
return res;
/* . and .. must listed before the other directories */
- if((file_a->stat.st_mode&LINUX_S_IFDIR) && strcmp(file_a->name, ".")==0)
+ if((file_a->st_mode&LINUX_S_IFDIR) && strcmp(file_a->name, ".")==0)
return -1;
- if((file_a->stat.st_mode&LINUX_S_IFDIR) && strcmp(file_a->name, "..")==0 &&
+ if((file_a->st_mode&LINUX_S_IFDIR) && strcmp(file_a->name, "..")==0 &&
!strcmp(file_b->name, ".")==0)
return -1;
/* Files and directories are sorted by name */
diff --git a/src/dir.h b/src/dir.h
index 7a1598c..e203bcb 100644
--- a/src/dir.h
+++ b/src/dir.h
@@ -63,10 +63,14 @@ struct file_data
file_data_t *prev;
file_data_t *next;
char name[DIR_NAME_LEN];
- struct stat stat;
-#ifdef DJGPP
- uint64_t file_size;
-#endif
+ uint32_t st_ino;
+ uint32_t st_mode;
+ uint32_t st_uid;
+ uint32_t st_gid;
+ uint64_t st_size;
+ time_t td_atime; /* time of last access */
+ time_t td_mtime; /* time of last modification */
+ time_t td_ctime; /* time of last status change */
unsigned int status;
};
@@ -74,10 +78,14 @@ typedef struct
{
struct td_list_head list;
char *name;
- struct stat stat;
-#ifdef DJGPP
- uint64_t file_size;
-#endif
+ uint32_t st_ino;
+ uint32_t st_mode;
+ uint32_t st_uid;
+ uint32_t st_gid;
+ uint64_t st_size;
+ time_t td_atime; /* time of last access */
+ time_t td_mtime; /* time of last modification */
+ time_t td_ctime; /* time of last status change */
unsigned int status;
} file_info_t;
diff --git a/src/dirn.c b/src/dirn.c
index f4c7a1d..20ddde6 100644
--- a/src/dirn.c
+++ b/src/dirn.c
@@ -97,10 +97,10 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
wbkgdset(window,' ' | COLOR_PAIR(1));
else if((current_file->status&FILE_STATUS_MARKED)!=0 && has_colors())
wbkgdset(window,' ' | COLOR_PAIR(2));
- if(current_file->stat.st_mtime!=0)
+ if(current_file->td_mtime!=0)
{
struct tm *tm_p;
- tm_p = localtime(&current_file->stat.st_mtime);
+ tm_p = localtime(&current_file->td_mtime);
snprintf(datestr, sizeof(datestr),"%2d-%s-%4d %02d:%02d",
tm_p->tm_mday, monstr[tm_p->tm_mon],
1900 + tm_p->tm_year, tm_p->tm_hour,
@@ -109,14 +109,10 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
} else {
strncpy(datestr, " ",sizeof(datestr));
}
- mode_string(current_file->stat.st_mode,str);
+ mode_string(current_file->st_mode, str);
wprintw(window, "%s %5u %5u ",
- str, (unsigned int)current_file->stat.st_uid, (unsigned int)current_file->stat.st_gid);
-#ifdef DJGPP
- wprintw(window, "%9llu", (long long unsigned int)current_file->file_size);
-#else
- wprintw(window, "%9llu", (long long unsigned int)current_file->stat.st_size);
-#endif
+ str, (unsigned int)current_file->st_uid, (unsigned int)current_file->st_gid);
+ wprintw(window, "%9llu", (long long unsigned int)current_file->st_size);
/* screen may overlap due to long filename */
wprintw(window, " %s %s", datestr, current_file->name);
if(((current_file->status&FILE_STATUS_DELETED)!=0 ||
@@ -294,9 +290,9 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
#ifdef PADENTER
case PADENTER:
#endif
- if((pos!=NULL) && (LINUX_S_ISDIR(pos->stat.st_mode)!=0))
+ if((pos!=NULL) && (LINUX_S_ISDIR(pos->st_mode)!=0))
{
- unsigned long int new_inode=pos->stat.st_ino;
+ unsigned long int new_inode=pos->st_ino;
if((new_inode!=inode) &&(strcmp(pos->name,".")!=0))
{
if(strcmp(pos->name,"..")==0)
@@ -338,7 +334,7 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
strcat(dir_data->current_directory,pos->name);
if(dir_data->local_dir==NULL)
{
- if(LINUX_S_ISDIR(pos->stat.st_mode)!=0)
+ if(LINUX_S_ISDIR(pos->st_mode)!=0)
dir_data->local_dir=ask_location("Please select a destination where %s and any files below will be copied.",
dir_data->current_directory, NULL);
else
@@ -356,11 +352,11 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
if(has_colors())
wbkgdset(window,' ' | COLOR_PAIR(0));
wrefresh(window);
- if(LINUX_S_ISDIR(pos->stat.st_mode)!=0)
+ if(LINUX_S_ISDIR(pos->st_mode)!=0)
{
res=copy_dir(disk, partition, dir_data, pos);
}
- else if(LINUX_S_ISREG(pos->stat.st_mode)!=0)
+ else if(LINUX_S_ISREG(pos->st_mode)!=0)
{
res=dir_data->copy_file(disk, partition, dir_data, pos);
}
@@ -419,7 +415,7 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
strcat(dir_data->current_directory,"/");
if(strcmp(tmp->name,".")!=0)
strcat(dir_data->current_directory,tmp->name);
- if(LINUX_S_ISDIR(tmp->stat.st_mode)!=0)
+ if(LINUX_S_ISDIR(tmp->st_mode)!=0)
{
const int res=copy_dir(disk, partition, dir_data, tmp);
if(res >=-1)
@@ -430,7 +426,7 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
else if(res < 0)
copy_bad=1;
}
- else if(LINUX_S_ISREG(tmp->stat.st_mode)!=0)
+ else if(LINUX_S_ISREG(tmp->st_mode)!=0)
{
if(dir_data->copy_file(disk, partition, dir_data, tmp) == 0)
{
@@ -575,9 +571,9 @@ static int copy_dir(disk_t *disk, const partition_t *partition, dir_data_t *dir_
int copy_ok=0;
if(dir_data->get_dir==NULL || dir_data->copy_file==NULL)
return -2;
- inode_known[dir_nbr++]=dir->stat.st_ino;
+ inode_known[dir_nbr++]=dir->st_ino;
dir_name=mkdir_local(dir_data->local_dir, dir_data->current_directory);
- dir_list=dir_data->get_dir(disk, partition, dir_data, (const unsigned long int)dir->stat.st_ino);
+ dir_list=dir_data->get_dir(disk, partition, dir_data, (const unsigned long int)dir->st_ino);
for(current_file=dir_list;current_file!=NULL;current_file=current_file->next)
{
dir_data->current_directory[current_directory_namelength]='\0';
@@ -586,9 +582,9 @@ static int copy_dir(disk_t *disk, const partition_t *partition, dir_data_t *dir_
if(strcmp(dir_data->current_directory,"/"))
strcat(dir_data->current_directory,"/");
strcat(dir_data->current_directory,current_file->name);
- if(LINUX_S_ISDIR(current_file->stat.st_mode)!=0)
+ if(LINUX_S_ISDIR(current_file->st_mode)!=0)
{
- const unsigned long int new_inode=current_file->stat.st_ino;
+ const unsigned long int new_inode=current_file->st_ino;
unsigned int new_inode_ok=1;
unsigned int i;
if(new_inode<2)
@@ -608,7 +604,7 @@ static int copy_dir(disk_t *disk, const partition_t *partition, dir_data_t *dir_
copy_bad=1;
}
}
- else if(LINUX_S_ISREG(current_file->stat.st_mode)!=0)
+ else if(LINUX_S_ISREG(current_file->st_mode)!=0)
{
// log_trace("copy_file %s\n",dir_data->current_directory);
int tmp;
@@ -622,7 +618,7 @@ static int copy_dir(disk_t *disk, const partition_t *partition, dir_data_t *dir_
}
dir_data->current_directory[current_directory_namelength]='\0';
delete_list_file(dir_list);
- set_date(dir_name, dir->stat.st_atime, dir->stat.st_mtime);
+ set_date(dir_name, dir->td_atime, dir->td_mtime);
free(dir_name);
dir_nbr--;
return (copy_bad>0?(copy_ok>0?-1:-2):0);
diff --git a/src/exfat_dir.c b/src/exfat_dir.c
index bf91e58..e143c20 100644
--- a/src/exfat_dir.c
+++ b/src/exfat_dir.c
@@ -110,29 +110,14 @@ static file_data_t *dir_exfat_aux(const unsigned char*buffer, const unsigned int
file_data_t *new_file=(file_data_t *)MALLOC(sizeof(*new_file));
sec_count=entry->sec_count;
new_file->name[0]=0;
- new_file->stat.st_dev=0;
- new_file->stat.st_ino=0;
- new_file->stat.st_mode = EXFAT_MKMODE(entry->attr,(LINUX_S_IRWXUGO & ~(LINUX_S_IWGRP|LINUX_S_IWOTH)));
- new_file->stat.st_nlink=0;
- new_file->stat.st_uid=0;
- new_file->stat.st_gid=0;
- new_file->stat.st_rdev=0;
- new_file->stat.st_size=0;
-#ifdef DJGPP
- new_file->file_size=0;
-#endif
-#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
- new_file->stat.st_blksize=0;
-#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
- if(new_file->stat.st_blksize!=0)
- {
- new_file->stat.st_blocks=0;
- }
-#endif
-#endif
- new_file->stat.st_atime=date_dos2unix(le16(entry->atime),le16(entry->adate));
- new_file->stat.st_ctime=date_dos2unix(le16(entry->ctime),le16(entry->cdate));
- new_file->stat.st_mtime=date_dos2unix(le16(entry->mtime),le16(entry->mdate));
+ new_file->st_ino=0;
+ new_file->st_mode = EXFAT_MKMODE(entry->attr,(LINUX_S_IRWXUGO & ~(LINUX_S_IWGRP|LINUX_S_IWOTH)));
+ new_file->st_uid=0;
+ new_file->st_gid=0;
+ new_file->st_size=0;
+ new_file->td_atime=date_dos2unix(le16(entry->atime),le16(entry->adate));
+ new_file->td_ctime=date_dos2unix(le16(entry->ctime),le16(entry->cdate));
+ new_file->td_mtime=date_dos2unix(le16(entry->mtime),le16(entry->mdate));
new_file->status=((entry->type&0x80)==0x80?0:FILE_STATUS_DELETED);
new_file->prev=current_file;
new_file->next=NULL;
@@ -149,14 +134,11 @@ static file_data_t *dir_exfat_aux(const unsigned char*buffer, const unsigned int
{
/* Stream extension */
const struct exfat_stream_ext_entry *entry=(const struct exfat_stream_ext_entry*)&buffer[offset];
- current_file->stat.st_size=le64(entry->data_length);
-#ifdef DJGPP
- current_file->file_size=le64(entry->data_length);
-#endif
- current_file->stat.st_ino=le32(entry->first_cluster);
+ current_file->st_size=le64(entry->data_length);
+ current_file->st_ino=le32(entry->first_cluster);
#if 0
if((entry->first_cluster&2)!=0)
- current_file->stat.st_size=0;
+ current_file->st_size=0;
#endif
}
else if((buffer[offset]&0x7f)==0x41)
@@ -313,11 +295,7 @@ static int exfat_copy(disk_t *disk, const partition_t *partition, dir_data_t *di
const unsigned int cluster_shift=exfat_header->block_per_clus_bits + exfat_header->blocksize_bits;
unsigned char *buffer_file=(unsigned char *)MALLOC(1<<cluster_shift);
unsigned int cluster;
-#ifdef DJGPP
- unsigned int file_size=file->file_size;
-#else
- unsigned int file_size=file->stat.st_size;
-#endif
+ uint64_t file_size=file->st_size;
unsigned int exfat_meth=exFAT_FOLLOW_CLUSTER;
uint64_t start_exfat1,clus_blocknr;
unsigned long int total_clusters;
@@ -329,7 +307,7 @@ static int exfat_copy(disk_t *disk, const partition_t *partition, dir_data_t *di
free(buffer_file);
return -1;
}
- cluster = file->stat.st_ino;
+ cluster = file->st_ino;
start_exfat1=le32(exfat_header->fat_blocknr) << exfat_header->blocksize_bits;
clus_blocknr=le32(exfat_header->clus_blocknr);
total_clusters=le32(exfat_header->total_clusters);
@@ -351,7 +329,7 @@ static int exfat_copy(disk_t *disk, const partition_t *partition, dir_data_t *di
{
log_error("exfat_copy: no space left on destination.\n");
fclose(f_out);
- set_date(new_file, file->stat.st_atime, file->stat.st_mtime);
+ set_date(new_file, file->td_atime, file->td_mtime);
free(new_file);
free(buffer_file);
return -1;
@@ -364,7 +342,7 @@ static int exfat_copy(disk_t *disk, const partition_t *partition, dir_data_t *di
const unsigned int next_cluster=get_next_cluster(disk, partition, UP_FAT32, start_exfat1, cluster);
if(next_cluster>=2 && next_cluster<=total_clusters)
cluster=next_cluster;
- else if(cluster==file->stat.st_ino && next_cluster==0)
+ else if(cluster==file->st_ino && next_cluster==0)
exfat_meth=exFAT_NEXT_FREE_CLUSTER; /* Recovery of a deleted file */
else
exfat_meth=exFAT_NEXT_CLUSTER; /* exFAT is corrupted, don't trust it */
@@ -379,7 +357,7 @@ static int exfat_copy(disk_t *disk, const partition_t *partition, dir_data_t *di
}
}
fclose(f_out);
- set_date(new_file, file->stat.st_atime, file->stat.st_mtime);
+ set_date(new_file, file->td_atime, file->td_mtime);
free(new_file);
free(buffer_file);
return 0;
diff --git a/src/ext2_dir.c b/src/ext2_dir.c
index 2271560..28bbe69 100644
--- a/src/ext2_dir.c
+++ b/src/ext2_dir.c
@@ -235,26 +235,18 @@ static int list_dir_proc2(ext2_ino_t dir,
new_file->status=FILE_STATUS_DELETED;
else
new_file->status=0;
- new_file->stat.st_dev=0;
- new_file->stat.st_ino=ino;
- new_file->stat.st_mode=inode.i_mode;
- new_file->stat.st_nlink=inode.i_links_count;
- new_file->stat.st_uid=inode.i_uid;
- new_file->stat.st_gid=inode.i_gid;
- new_file->stat.st_rdev=0;
- new_file->stat.st_size=LINUX_S_ISDIR(inode.i_mode)?inode.i_size:
+ new_file->st_ino=ino;
+ new_file->st_mode=inode.i_mode;
+// new_file->st_nlink=inode.i_links_count;
+ new_file->st_uid=inode.i_uid;
+ new_file->st_gid=inode.i_gid;
+ new_file->st_size=LINUX_S_ISDIR(inode.i_mode)?inode.i_size:
inode.i_size| ((uint64_t)inode.i_size_high << 32);
-#ifdef DJGPP
- new_file->file_size=LINUX_S_ISDIR(inode.i_mode)?inode.i_size:
- inode.i_size| ((uint64_t)inode.i_size_high << 32);
-#endif
- new_file->stat.st_blksize=blocksize;
-#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
- new_file->stat.st_blocks=inode.i_blocks;
-#endif
- new_file->stat.st_atime=inode.i_atime;
- new_file->stat.st_mtime=inode.i_mtime;
- new_file->stat.st_ctime=inode.i_ctime;
+// new_file->st_blksize=blocksize;
+// new_file->st_blocks=inode.i_blocks;
+ new_file->td_atime=inode.i_atime;
+ new_file->td_mtime=inode.i_mtime;
+ new_file->td_ctime=inode.i_ctime;
if(ls->current_file!=NULL)
ls->current_file->next=new_file;
else
@@ -303,14 +295,14 @@ static int ext2_copy(disk_t *disk_car, const partition_t *partition, dir_data_t
char buffer[8192];
ext2_file_t e2_file;
- if (ext2fs_read_inode(ls->current_fs, file->stat.st_ino, &inode)!=0)
+ if (ext2fs_read_inode(ls->current_fs, file->st_ino, &inode)!=0)
{
free(new_file);
fclose(f_out);
return -1;
}
- retval = ext2fs_file_open(ls->current_fs, file->stat.st_ino, 0, &e2_file);
+ retval = ext2fs_file_open(ls->current_fs, file->st_ino, 0, &e2_file);
if (retval) {
log_error("Error while opening ext2 file %s\n", dir_data->current_directory);
free(new_file);
@@ -343,8 +335,8 @@ static int ext2_copy(disk_t *disk_car, const partition_t *partition, dir_data_t
error = -6;
}
fclose(f_out);
- set_date(new_file, file->stat.st_atime, file->stat.st_mtime);
- set_mode(new_file, file->stat.st_mode);
+ set_date(new_file, file->td_atime, file->td_mtime);
+ set_mode(new_file, file->st_mode);
}
free(new_file);
return error;
diff --git a/src/fat_adv.c b/src/fat_adv.c
index f9be08a..23d2a67 100644
--- a/src/fat_adv.c
+++ b/src/fat_adv.c
@@ -214,9 +214,9 @@ static int ask_root_directory(disk_t *disk_car, const partition_t *partition, co
}
else
waddstr(window, " ");
- if(current_file->stat.st_mtime!=0)
+ if(current_file->td_mtime!=0)
{
- const struct tm *tm_p=localtime(&current_file->stat.st_mtime);
+ const struct tm *tm_p=localtime(&current_file->td_mtime);
snprintf(datestr, sizeof(datestr),"%2d-%s-%4d %02d:%02d",
tm_p->tm_mday, monstr[tm_p->tm_mon],
1900 + tm_p->tm_year, tm_p->tm_hour,
@@ -224,14 +224,10 @@ static int ask_root_directory(disk_t *disk_car, const partition_t *partition, co
} else {
strncpy(datestr, " ",sizeof(datestr));
}
- mode_string(current_file->stat.st_mode,str);
+ mode_string(current_file->st_mode, str);
wprintw(window, "%s %3u %3u ",
- str, (unsigned int)current_file->stat.st_uid, (unsigned int)current_file->stat.st_gid);
-#ifdef DJGPP
- wprintw(window, "%9llu", (long long unsigned int)current_file->file_size);
-#else
- wprintw(window, "%9llu", (long long unsigned int)current_file->stat.st_size);
-#endif
+ str, (unsigned int)current_file->st_uid, (unsigned int)current_file->st_gid);
+ wprintw(window, "%9llu", (long long unsigned int)current_file->st_size);
/* FIXME: screen overlaps due to long filename */
wprintw(window, " %s %s\n", datestr, current_file->name);
if(current_file==pos)
@@ -504,7 +500,7 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
{
file_data_t *dir_list;
dir_list=dir_fat_aux(buffer, cluster_size, cluster_size, 0);
- if(dir_list!=NULL && (dir_list->next==NULL || dir_list->stat.st_ino!=dir_list->next->stat.st_ino))
+ if(dir_list!=NULL && (dir_list->next==NULL || dir_list->st_ino!=dir_list->next->st_ino))
{
int test_date=1;
if(verbose>0)
@@ -624,15 +620,11 @@ static int file2entry(struct msdos_dir_entry *de, const file_data_t *current_fil
{
de->ext[j]=' ';
}
- de->attr=(LINUX_S_ISDIR(current_file->stat.st_mode)!=0?ATTR_DIR:ATTR_NONE);
- fat_date_unix2dos(current_file->stat.st_mtime,&de->time,&de->date);
- de->start=le16(current_file->stat.st_ino);
- de->starthi=le16(current_file->stat.st_ino>>16);
-#ifdef DJGPP
- de->size=le32(current_file->file_size);
-#else
- de->size=le32(current_file->stat.st_size);
-#endif
+ de->attr=(LINUX_S_ISDIR(current_file->st_mode)!=0?ATTR_DIR:ATTR_NONE);
+ fat_date_unix2dos(current_file->td_mtime,&de->time,&de->date);
+ de->start=le16(current_file->st_ino);
+ de->starthi=le16(current_file->st_ino>>16);
+ de->size=le32(current_file->st_size);
return 0;
}
@@ -842,10 +834,10 @@ static int analyse_dir_entries2(disk_t *disk_car,const partition_t *partition, c
{
dir_aff_log(NULL, dir_list);
}
- for(current_file=dir_list;(current_file!=NULL)&&(LINUX_S_ISDIR(current_file->stat.st_mode)==0);current_file=current_file->next);
+ for(current_file=dir_list;(current_file!=NULL)&&(LINUX_S_ISDIR(current_file->st_mode)==0);current_file=current_file->next);
if(current_file!=NULL)
{
- unsigned long int new_inode=current_file->stat.st_ino;
+ unsigned long int new_inode=current_file->st_ino;
unsigned int dir_entries;
if(verbose>1)
{
diff --git a/src/fat_dir.c b/src/fat_dir.c
index ba55df0..f63298b 100644
--- a/src/fat_dir.c
+++ b/src/fat_dir.c
@@ -282,27 +282,13 @@ RecEnd:
new_file->name[o++]=(char) unicode[i];
}
new_file->name[o]=0;
- new_file->stat.st_dev=0;
- new_file->stat.st_ino=inode;
- new_file->stat.st_mode = MSDOS_MKMODE(de->attr,(LINUX_S_IRWXUGO & ~(LINUX_S_IWGRP|LINUX_S_IWOTH)));
- new_file->stat.st_nlink=0;
- new_file->stat.st_uid=0;
- new_file->stat.st_gid=0;
- new_file->stat.st_rdev=0;
- new_file->stat.st_size=le32(de->size);
-#ifdef DJGPP
- new_file->file_size=le32(de->size);
-#endif
-#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
- new_file->stat.st_blksize=cluster_size;
-#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
- if(new_file->stat.st_blksize!=0)
- {
- new_file->stat.st_blocks=(le32(de->size) + new_file->stat.st_blksize - 1) / new_file->stat.st_blksize;
- }
-#endif
-#endif
- new_file->stat.st_atime=new_file->stat.st_ctime=new_file->stat.st_mtime=date_dos2unix(le16(de->time),le16(de->date));
+ new_file->st_ino=inode;
+ new_file->st_mode = MSDOS_MKMODE(de->attr,(LINUX_S_IRWXUGO & ~(LINUX_S_IWGRP|LINUX_S_IWOTH)));
+ new_file->st_uid=0;
+ new_file->st_gid=0;
+ new_file->st_size=le32(de->size);
+// new_file->st_blksize=cluster_size;
+ new_file->td_atime=new_file->td_ctime=new_file->td_mtime=date_dos2unix(le16(de->time),le16(de->date));
new_file->status=status;
new_file->prev=current_file;
new_file->next=NULL;
@@ -510,11 +496,7 @@ static int fat_copy(disk_t *disk_car, const partition_t *partition, dir_data_t *
const unsigned int block_size=fat_sector_size(fat_header)*sectors_per_cluster;
unsigned char *buffer_file=(unsigned char *)MALLOC(block_size);
unsigned int cluster;
-#ifdef DJGPP
- unsigned int file_size=file->file_size;
-#else
- unsigned int file_size=file->stat.st_size;
-#endif
+ unsigned int file_size=file->st_size;
unsigned int fat_meth=FAT_FOLLOW_CLUSTER;
uint64_t start_fat1,start_data,part_size;
unsigned long int no_of_cluster,fat_length;
@@ -526,7 +508,7 @@ static int fat_copy(disk_t *disk_car, const partition_t *partition, dir_data_t *
free(buffer_file);
return -1;
}
- cluster = file->stat.st_ino;
+ cluster = file->st_ino;
fat_length=le16(fat_header->fat_length)>0?le16(fat_header->fat_length):le32(fat_header->fat32_length);
part_size=(sectors(fat_header)>0?sectors(fat_header):le32(fat_header->total_sect));
start_fat1=le16(fat_header->reserved);
@@ -551,7 +533,7 @@ static int fat_copy(disk_t *disk_car, const partition_t *partition, dir_data_t *
{
log_error("fat_copy: failed to write data %s\n", strerror(errno));
fclose(f_out);
- set_date(new_file, file->stat.st_atime, file->stat.st_mtime);
+ set_date(new_file, file->td_atime, file->td_mtime);
free(new_file);
free(buffer_file);
return -1;
@@ -564,7 +546,7 @@ static int fat_copy(disk_t *disk_car, const partition_t *partition, dir_data_t *
const unsigned int next_cluster=get_next_cluster(disk_car, partition, partition->upart_type, start_fat1, cluster);
if(next_cluster>=2 && next_cluster<=no_of_cluster+2)
cluster=next_cluster;
- else if(cluster==file->stat.st_ino && next_cluster==0)
+ else if(cluster==file->st_ino && next_cluster==0)
fat_meth=FAT_NEXT_FREE_CLUSTER; /* Recovery of a deleted file */
else
fat_meth=FAT_NEXT_CLUSTER; /* FAT is corrupted, don't trust it */
@@ -579,7 +561,7 @@ static int fat_copy(disk_t *disk_car, const partition_t *partition, dir_data_t *
}
}
fclose(f_out);
- set_date(new_file, file->stat.st_atime, file->stat.st_mtime);
+ set_date(new_file, file->td_atime, file->td_mtime);
free(new_file);
free(buffer_file);
return 0;
diff --git a/src/fat_unformat.c b/src/fat_unformat.c
index 9c91c44..fa751e9 100644
--- a/src/fat_unformat.c
+++ b/src/fat_unformat.c
@@ -136,14 +136,10 @@ static int fat_copy_file(disk_t *disk, const partition_t *partition, const unsig
char *new_file;
FILE *f_out;
unsigned int cluster;
-#ifdef DJGPP
- unsigned int file_size=file->file_size;
-#else
- unsigned int file_size=file->stat.st_size;
-#endif
+ unsigned int file_size=file->st_size;
const unsigned long int no_of_cluster=(partition->part_size - start_data) / cluster_size;
unsigned char *buffer_file=(unsigned char *)MALLOC(cluster_size);
- cluster = file->stat.st_ino;
+ cluster = file->st_ino;
new_file=(char *)MALLOC(1024);
snprintf(new_file, 1024, "%s.%u/inode_%u", recup_dir, dir_num, inode_num);
#ifdef HAVE_MKDIR
@@ -185,7 +181,7 @@ static int fat_copy_file(disk_t *disk, const partition_t *partition, const unsig
{
log_error("fat_copy_file: no space left on destination.\n");
fclose(f_out);
- set_date(new_file, file->stat.st_atime, file->stat.st_mtime);
+ set_date(new_file, file->td_atime, file->td_mtime);
free(new_file);
free(buffer_file);
return -1;
@@ -194,7 +190,7 @@ static int fat_copy_file(disk_t *disk, const partition_t *partition, const unsig
cluster++;
}
fclose(f_out);
- set_date(new_file, file->stat.st_atime, file->stat.st_mtime);
+ set_date(new_file, file->td_atime, file->td_mtime);
free(new_file);
free(buffer_file);
return 0;
@@ -253,15 +249,15 @@ static int fat_unformat_aux(struct ph_param *params, const struct ph_options *op
current_file=dir_list;
while(current_file!=NULL)
{
- if(current_file->stat.st_ino<2 ||
- current_file->stat.st_ino >= no_of_cluster+2)
+ if(current_file->st_ino<2 ||
+ current_file->st_ino >= no_of_cluster+2)
current_file=NULL;
- else if(LINUX_S_ISDIR(current_file->stat.st_mode)!=0)
+ else if(LINUX_S_ISDIR(current_file->st_mode)!=0)
{
if(strcmp(current_file->name,".")==0)
{
if(current_file==dir_list)
- dir_inode=current_file->stat.st_ino;
+ dir_inode=current_file->st_ino;
else
current_file=NULL;
}
@@ -276,7 +272,7 @@ static int fat_unformat_aux(struct ph_param *params, const struct ph_options *op
char *new_file=(char *)MALLOC(1024);
snprintf(new_file, 1024, "%s.%u/inode_%u/inode_%u_%s",
params->recup_dir, params->dir_num, dir_inode,
- (unsigned int)current_file->stat.st_ino, current_file->name);
+ (unsigned int)current_file->st_ino, current_file->name);
#ifdef __MINGW32__
mkdir(new_file);
#else
@@ -286,14 +282,10 @@ static int fat_unformat_aux(struct ph_param *params, const struct ph_options *op
#endif
}
}
- else if(LINUX_S_ISREG(current_file->stat.st_mode)!=0)
+ else if(LINUX_S_ISREG(current_file->st_mode)!=0)
{
- const uint64_t file_start=start_data + (uint64_t)(current_file->stat.st_ino - 2) * cluster_size;
-#ifdef DJGPP
- const uint64_t file_end=file_start+(current_file->file_size+cluster_size-1)/cluster_size*cluster_size - 1;
-#else
- const uint64_t file_end=file_start+(current_file->stat.st_size+cluster_size-1)/cluster_size*cluster_size - 1;
-#endif
+ const uint64_t file_start=start_data + (uint64_t)(current_file->st_ino - 2) * cluster_size;
+ const uint64_t file_end=file_start+(current_file->st_size+cluster_size-1)/cluster_size*cluster_size - 1;
if(file_end < partition->part_offset + partition->part_size)
{
if(fat_copy_file(disk, partition, cluster_size, start_data, params->recup_dir, params->dir_num, dir_inode, current_file)==0)
diff --git a/src/ntfs_dir.c b/src/ntfs_dir.c
index fcf542c..ebbc05e 100644
--- a/src/ntfs_dir.c
+++ b/src/ntfs_dir.c
@@ -222,15 +222,9 @@ static int ntfs_td_list_entry( struct ntfs_dir_struct *ls, const ntfschar *name
new_file->status=0;
new_file->prev=ls->current_file;
new_file->next=NULL;
- new_file->stat.st_dev=0;
- new_file->stat.st_ino=MREF(mref);
- new_file->stat.st_nlink=1;
- new_file->stat.st_uid=0;
- new_file->stat.st_gid=0;
- new_file->stat.st_rdev=0;
-#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
- new_file->stat.st_blksize=DEFAULT_SECTOR_SIZE;
-#endif
+ new_file->st_ino=MREF(mref);
+ new_file->st_uid=0;
+ new_file->st_gid=0;
ctx_si = ntfs_attr_get_search_ctx(ni, ni->mrec);
if (ctx_si)
@@ -242,9 +236,9 @@ static int ntfs_td_list_entry( struct ntfs_dir_struct *ls, const ntfschar *name
le16_to_cpu(attr->value_offset));
if(si)
{
- new_file->stat.st_atime=td_ntfs2utc(sle64_to_cpu(si->last_access_time));
- new_file->stat.st_mtime=td_ntfs2utc(sle64_to_cpu(si->last_data_change_time));
- new_file->stat.st_ctime=td_ntfs2utc(sle64_to_cpu(si->creation_time));
+ new_file->td_atime=td_ntfs2utc(sle64_to_cpu(si->last_access_time));
+ new_file->td_mtime=td_ntfs2utc(sle64_to_cpu(si->last_data_change_time));
+ new_file->td_ctime=td_ntfs2utc(sle64_to_cpu(si->creation_time));
}
}
ntfs_attr_put_search_ctx(ctx_si);
@@ -256,14 +250,8 @@ static int ntfs_td_list_entry( struct ntfs_dir_struct *ls, const ntfschar *name
if (dt_type == NTFS_DT_DIR)
{
snprintf(new_file->name, sizeof(new_file->name), "%s", filename);
- new_file->stat.st_mode = LINUX_S_IFDIR| LINUX_S_IRUGO | LINUX_S_IXUGO;
- new_file->stat.st_size=0;
-#ifdef DJGPP
- new_file->file_size=0;
-#endif
-#if defined(HAVE_STRUCT_STAT_ST_BLOCKS)
- new_file->stat.st_blocks=0;
-#endif
+ new_file->st_mode = LINUX_S_IFDIR| LINUX_S_IRUGO | LINUX_S_IXUGO;
+ new_file->st_size=0;
new_file->prev=ls->current_file;
new_file->next=NULL;
if(ls->current_file!=NULL)
@@ -285,15 +273,8 @@ static int ntfs_td_list_entry( struct ntfs_dir_struct *ls, const ntfschar *name
new_file=(file_data_t *)MALLOC(sizeof(*new_file));
memcpy(new_file, old_file, sizeof(*new_file));
}
- new_file->stat.st_mode = LINUX_S_IFREG | LINUX_S_IRUGO;
- new_file->stat.st_size=filesize;
-#ifdef DJGPP
- new_file->file_size=filesize;
-#endif
-#if defined(HAVE_STRUCT_STAT_ST_BLOCKS) && defined(HAVE_STRUCT_STAT_ST_BLKSIZE)
- if(new_file->stat.st_blksize!=0)
- new_file->stat.st_blocks=(filesize + new_file->stat.st_blksize - 1) / new_file->stat.st_blksize;
-#endif
+ new_file->st_mode = LINUX_S_IFREG | LINUX_S_IRUGO;
+ new_file->st_size=filesize;
if (rec->name_length)
{
char *stream_name=NULL;
@@ -373,7 +354,7 @@ enum { bufsize = 4096 };
static int ntfs_copy(disk_t *disk_car, const partition_t *partition, dir_data_t *dir_data, const file_data_t *file)
{
- const unsigned long int first_inode=file->stat.st_ino;
+ const unsigned long int first_inode=file->st_ino;
ntfs_inode *inode;
struct ntfs_dir_struct *ls=(struct ntfs_dir_struct*)dir_data->private_dir_data;
inode = ntfs_inode_open (ls->vol, first_inode);
@@ -464,7 +445,7 @@ static int ntfs_copy(disk_t *disk_car, const partition_t *partition, dir_data_t
offset += bytes_read;
}
fclose(f_out);
- set_date(new_file, file->stat.st_atime, file->stat.st_mtime);
+ set_date(new_file, file->td_atime, file->td_mtime);
free(new_file);
ntfs_attr_close(attr);
free(buffer);
diff --git a/src/ntfs_udl.c b/src/ntfs_udl.c
index d4f10fc..e838c53 100644
--- a/src/ntfs_udl.c
+++ b/src/ntfs_udl.c
@@ -1097,28 +1097,13 @@ static file_info_t *ufile_to_file_data(const struct ufile *file, const struct da
(file->pref_name?file->pref_name:inode_name),
(d->name?":":""),
(d->name?d->name:""));
- new_file->stat.st_dev=0;
- new_file->stat.st_ino=file->inode;
- new_file->stat.st_mode = (file->directory ?LINUX_S_IFDIR| LINUX_S_IRUGO | LINUX_S_IXUGO:LINUX_S_IFREG | LINUX_S_IRUGO);
- new_file->stat.st_nlink=0;
- new_file->stat.st_uid=0;
- new_file->stat.st_gid=0;
- new_file->stat.st_rdev=0;
-
- new_file->stat.st_size=max(d->size_init, d->size_data);
-#ifdef DJGPP
- new_file->file_size=max(d->size_init, d->size_data);
-#endif
-#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
- new_file->stat.st_blksize=512; /* FIXME cluster_size */
-#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
- if(new_file->stat.st_blksize!=0)
- {
- new_file->stat.st_blocks=(file->max_size + new_file->stat.st_blksize - 1) / new_file->stat.st_blksize;
- }
-#endif
-#endif
- new_file->stat.st_atime=new_file->stat.st_ctime=new_file->stat.st_mtime=file->date;
+ new_file->st_ino=file->inode;
+ new_file->st_mode = (file->directory ?LINUX_S_IFDIR| LINUX_S_IRUGO | LINUX_S_IXUGO:LINUX_S_IFREG | LINUX_S_IRUGO);
+ new_file->st_uid=0;
+ new_file->st_gid=0;
+
+ new_file->st_size=max(d->size_init, d->size_data);
+ new_file->td_atime=new_file->td_ctime=new_file->td_mtime=file->date;
new_file->status=0;
return new_file;
}
@@ -1290,9 +1275,9 @@ static void ntfs_undelete_menu_ncurses(disk_t *disk_car, const partition_t *part
waddstr(window, " ");
if((file_info->status&FILE_STATUS_MARKED)!=0 && has_colors())
wbkgdset(window,' ' | COLOR_PAIR(2));
- if(file_info->stat.st_mtime!=0)
+ if(file_info->td_mtime!=0)
{
- const struct tm *tm_p= localtime(&file_info->stat.st_mtime);
+ const struct tm *tm_p= localtime(&file_info->td_mtime);
snprintf(datestr, sizeof(datestr),"%2d-%s-%4d %02d:%02d",
tm_p->tm_mday, monstr[tm_p->tm_mon],
1900 + tm_p->tm_year, tm_p->tm_hour,
@@ -1312,11 +1297,7 @@ static void ntfs_undelete_menu_ncurses(disk_t *disk_car, const partition_t *part
wprintw(window, "%-*s", nbr, &file_info->name[strlen(file_info->name) - nbr]);
}
wprintw(window, " %s ", datestr);
-#ifdef DJGPP
- wprintw(window, "%9llu", (long long unsigned int)file_info->file_size);
-#else
- wprintw(window, "%9llu", (long long unsigned int)file_info->stat.st_size);
-#endif
+ wprintw(window, "%9llu", (long long unsigned int)file_info->st_size);
if((file_info->status&FILE_STATUS_MARKED)!=0 && has_colors())
wbkgdset(window,' ' | COLOR_PAIR(0));
if(file_walker==current_file)
@@ -1487,7 +1468,7 @@ static void ntfs_undelete_menu_ncurses(disk_t *disk_car, const partition_t *part
file_info_t *file_info;
file_info=td_list_entry(file_walker, file_info_t, list);
if((file_info->status&FILE_STATUS_DELETED)==0 &&
- file_info->stat.st_size < min_size)
+ file_info->st_size < min_size)
file_info->status|=FILE_STATUS_DELETED;
}
pos_num=0;
@@ -1513,12 +1494,12 @@ static void ntfs_undelete_menu_ncurses(disk_t *disk_car, const partition_t *part
file_info_t *file_info;
file_info=td_list_entry(current_file, file_info_t, list);
if(current_file!=&dir_list->list &&
- LINUX_S_ISDIR(file_info->stat.st_mode)==0)
+ LINUX_S_ISDIR(file_info->st_mode)==0)
{
if(dir_data->local_dir==NULL)
{
char *res;
- if(LINUX_S_ISDIR(file_info->stat.st_mode)!=0)
+ if(LINUX_S_ISDIR(file_info->st_mode)!=0)
res=ask_location("Please select a destination where %s and any files below will be copied.",
file_info->name, NULL);
else
@@ -1538,7 +1519,7 @@ static void ntfs_undelete_menu_ncurses(disk_t *disk_car, const partition_t *part
if(has_colors())
wbkgdset(window,' ' | COLOR_PAIR(0));
wrefresh(window);
- res=undelete_file(ls->vol, file_info->stat.st_ino);
+ res=undelete_file(ls->vol, file_info->st_ino);
wmove(window,5,0);
wclrtoeol(window);
if(res < -1)
@@ -1586,7 +1567,7 @@ static void ntfs_undelete_menu_ncurses(disk_t *disk_car, const partition_t *part
file_info=td_list_entry(file_walker, file_info_t, list);
if((file_info->status&FILE_STATUS_MARKED)!=0)
{
- if(undelete_file(ls->vol, file_info->stat.st_ino) < 0)
+ if(undelete_file(ls->vol, file_info->st_ino) < 0)
file_bad++;
else
{
diff --git a/src/rfs_dir.c b/src/rfs_dir.c
index 74efbd3..81882df 100644
--- a/src/rfs_dir.c
+++ b/src/rfs_dir.c
@@ -449,11 +449,16 @@ static file_data_t *reiser_dir(disk_t *disk_car, const partition_t *partition, d
new_file->status=0;
new_file->prev=ls->current_file;
new_file->next=NULL;
- new_file->stat.st_size=entity->stat.st_size;
-#ifdef DJGPP
- new_file->file_size=entity->stat.st_size;
-#endif
- memcpy(&new_file->stat,&entity->stat,sizeof(new_file->stat));
+ new_file->st_ino=entity->stat.st_ino;
+ new_file->st_mode=entity->stat.st_mode;
+// new_file->st_nlink=entity->stat.st_nlink;
+ new_file->st_uid=entity->stat.st_uid;
+ new_file->st_gid=entity->stat.st_gid;
+ new_file->st_size=entity->stat.st_size;
+// new_file->st_blksize=entity->stat.st_blksize;
+ new_file->td_atime=entity->stat.st_atime;
+ new_file->td_mtime=entity->stat.st_mtime;
+ new_file->td_ctime=entity->stat.st_ctime;
reiserfs_object_free(entity);
if(ls->current_file)
ls->current_file->next=new_file;
@@ -543,8 +548,8 @@ static int reiser_copy(disk_t *disk_car, const partition_t *partition, dir_data_
#endif
reiserfs_file_close(in);
fclose(f_out);
- set_date(new_file, file->stat.st_atime, file->stat.st_mtime);
- set_mode(new_file, file->stat.st_mode);
+ set_date(new_file, file->td_atime, file->td_mtime);
+ set_mode(new_file, file->st_mode);
free(new_file);
return error;
}