Do not call utime() when using frama-c, fix some minor warnings.

This commit is contained in:
Christophe Grenier 2019-11-01 10:56:57 +01:00
parent 91ba106b25
commit 87ff1ddb86
6 changed files with 18 additions and 12 deletions

View file

@ -80,6 +80,18 @@ extras:
extrasstatic: extrasstatic:
$(MAKE) LDFLAGS="$(LDFLAGS) -static" LIBS="$(PTHREAD_LIBS) $(LIBS)" CFLAGS="$(PTHREAD_CFLAGS) $(CFLAGS)" CXXFLAGS="$(PTHREAD_CFLAGS) $(CXXFLAGS)" extras $(MAKE) LDFLAGS="$(LDFLAGS) -static" LIBS="$(PTHREAD_LIBS) $(LIBS)" CFLAGS="$(PTHREAD_CFLAGS) $(CFLAGS)" CXXFLAGS="$(PTHREAD_CFLAGS) $(CXXFLAGS)" extras
session_doc.framac: src/file_doc.c src/common.c src/filegen.c src/log.c src/setdate.c
gcc -W -Wall -DMAIN_doc -DHAVE_CONFIG_H -O -o demo -I. $^
frama-c $^ -cpp-extra-args="-DMAIN_doc -DHAVE_CONFIG_H -D__x86_64__" $(FRAMA_C_FLAGS) -save $@
session_id3.framac: src/file_mp3.c src/common.c src/filegen.c src/log.c
gcc -W -Wall -DMAIN_id3 -DHAVE_CONFIG_H -O -o demo -I. $^
frama-c $^ -cpp-extra-args="-DMAIN_id3 -DHAVE_CONFIG_H -D__x86_64__" $(FRAMA_C_FLAGS) -save $@
session_jpg.framac: src/file_jpg.c src/common.c src/filegen.c src/log.c src/suspend_no.c src/setdate.c
gcc -W -Wall -DMAIN_jpg -DHAVE_CONFIG_H -O -o demo -I. $^ -ljpeg
frama-c $^ -cpp-extra-args="-DMAIN_jpg -DHAVE_CONFIG_H -D__x86_64__ -I/usr/include -I $(frama-c -print-path)/libc" $(FRAMA_C_FLAGS) -save $@
session_tiff_be.framac: src/file_tiff.c src/file_tiff_be.c src/file_tiff_le.c src/common.c src/filegen.c src/log.c session_tiff_be.framac: src/file_tiff.c src/file_tiff_be.c src/file_tiff_le.c src/common.c src/filegen.c src/log.c
gcc -W -Wall -DMAIN_tiff_le -DHAVE_CONFIG_H -O -o demo -I. $^ gcc -W -Wall -DMAIN_tiff_le -DHAVE_CONFIG_H -O -o demo -I. $^
frama-c $^ -cpp-extra-args="-DMAIN_tiff_le -DHAVE_CONFIG_H -D__x86_64__" $(FRAMA_C_FLAGS) -save $@ frama-c $^ -cpp-extra-args="-DMAIN_tiff_le -DHAVE_CONFIG_H -D__x86_64__" $(FRAMA_C_FLAGS) -save $@
@ -88,14 +100,6 @@ session_tiff_le.framac: src/file_tiff.c src/file_tiff_be.c src/file_tiff_le.c sr
gcc -W -Wall -DMAIN_tiff_le -DHAVE_CONFIG_H -O -o demo -I. $^ gcc -W -Wall -DMAIN_tiff_le -DHAVE_CONFIG_H -O -o demo -I. $^
frama-c $^ -cpp-extra-args="-DMAIN_tiff_le -DHAVE_CONFIG_H -D__x86_64__" $(FRAMA_C_FLAGS) -save $@ frama-c $^ -cpp-extra-args="-DMAIN_tiff_le -DHAVE_CONFIG_H -D__x86_64__" $(FRAMA_C_FLAGS) -save $@
session_id3.framac: src/file_mp3.c src/common.c src/filegen.c src/log.c
gcc -W -Wall -DMAIN_id3 -DHAVE_CONFIG_H -O -o demo -I. $^
frama-c $^ -cpp-extra-args="-DMAIN_id3 -DHAVE_CONFIG_H -D__x86_64__" $(FRAMA_C_FLAGS) -save $@
session_doc.framac: src/file_doc.c src/common.c src/filegen.c src/log.c src/setdate.c
gcc -W -Wall -DMAIN_doc -DHAVE_CONFIG_H -O -o demo -I. $^
frama-c $^ -cpp-extra-args="-DMAIN_doc -DHAVE_CONFIG_H -D__x86_64__" $(FRAMA_C_FLAGS) -save $@
session_%.framac: src/file_%.c src/common.c src/filegen.c src/log.c session_%.framac: src/file_%.c src/common.c src/filegen.c src/log.c
gcc -W -Wall -DMAIN_$* -DHAVE_CONFIG_H -O -o demo -I. $^ gcc -W -Wall -DMAIN_$* -DHAVE_CONFIG_H -O -o demo -I. $^
frama-c $^ -cpp-extra-args="-DMAIN_$* -DHAVE_CONFIG_H -D__x86_64__" $(FRAMA_C_FLAGS) -save $@ frama-c $^ -cpp-extra-args="-DMAIN_$* -DHAVE_CONFIG_H -D__x86_64__" $(FRAMA_C_FLAGS) -save $@

View file

@ -6,7 +6,7 @@ AC_INIT([testdisk],[7.2-WIP],[grenier@cgsecurity.org])
AC_LANG(C) AC_LANG(C)
sinclude(acx_pthread.m4) sinclude(acx_pthread.m4)
sinclude(mkdir.m4) sinclude(mkdir.m4)
TESTDISKDATE="July 2019" TESTDISKDATE="November 2019"
AC_SUBST(TESTDISKDATE) AC_SUBST(TESTDISKDATE)
AC_DEFINE_UNQUOTED([TESTDISKDATE],"$TESTDISKDATE",[Date of release]) AC_DEFINE_UNQUOTED([TESTDISKDATE],"$TESTDISKDATE",[Date of release])
AC_CONFIG_AUX_DIR(config) AC_CONFIG_AUX_DIR(config)

View file

@ -912,7 +912,7 @@ int main()
file_stats.file_hint=&file_hint_exe; file_stats.file_hint=&file_hint_exe;
file_stats.not_recovered=0; file_stats.not_recovered=0;
file_stats.recovered=0; file_stats.recovered=0;
file_hint_exe.register_header_check(&file_stats); register_header_check_exe(&file_stats);
if(header_check_exe(buffer, BLOCKSIZE, 0u, &file_recovery, &file_recovery_new)!=1) if(header_check_exe(buffer, BLOCKSIZE, 0u, &file_recovery, &file_recovery_new)!=1)
return 0; return 0;
/*@ assert valid_read_string((char *)&fn); */ /*@ assert valid_read_string((char *)&fn); */

View file

@ -120,7 +120,7 @@ static int header_check_m2ts(const unsigned char *buffer, const unsigned int buf
if(file_recovery->file_stat!=NULL && if(file_recovery->file_stat!=NULL &&
file_recovery->file_stat->file_hint==&file_hint_m2ts && file_recovery->file_stat->file_hint==&file_hint_m2ts &&
(file_recovery->data_check==&data_check_ts_192 || (file_recovery->data_check==&data_check_ts_192 ||
file_recovery->blocksize < 5)) file_recovery_new->blocksize < 5))
{ {
header_ignored(file_recovery_new); header_ignored(file_recovery_new);
return 0; return 0;

View file

@ -665,7 +665,7 @@ int main()
file_stats.file_hint=&file_hint_mp3; file_stats.file_hint=&file_hint_mp3;
file_stats.not_recovered=0; file_stats.not_recovered=0;
file_stats.recovered=0; file_stats.recovered=0;
file_hint_mp3.register_header_check(&file_stats); register_header_check_mp3(&file_stats);
if(header_check_id3(buffer, BLOCKSIZE, 0u, &file_recovery, &file_recovery_new) != 1) if(header_check_id3(buffer, BLOCKSIZE, 0u, &file_recovery, &file_recovery_new) != 1)
return 0; return 0;
/*@ assert valid_read_string((char *)&fn); */ /*@ assert valid_read_string((char *)&fn); */

View file

@ -49,10 +49,12 @@ int set_date(const char *pathname, time_t actime, time_t modtime)
return -1; return -1;
ut.actime = actime; ut.actime = actime;
ut.modtime = modtime; ut.modtime = modtime;
#ifndef __FRAMAC__
if (utime(pathname, &ut)) { if (utime(pathname, &ut)) {
log_error("ERROR: Couldn't set the file's date and time for %s\n", pathname); log_error("ERROR: Couldn't set the file's date and time for %s\n", pathname);
return -1; return -1;
} }
#endif
#endif #endif
return 0; return 0;
} }