From 7a767a391746dfaec53c4e7030a342e61be3eefe Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Sat, 10 Sep 2022 10:07:50 +0200 Subject: [PATCH] Fix for 2038 compatibility --- src/fat_adv.c | 3 +-- src/savehdr.c | 2 +- src/sessionp.c | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/fat_adv.c b/src/fat_adv.c index c6f6790d..bd7fde00 100644 --- a/src/fat_adv.c +++ b/src/fat_adv.c @@ -88,7 +88,6 @@ static int check_FAT_dir_entry(const unsigned char *entry, const unsigned int en static unsigned long int get_subdirectory(disk_t *disk_car,const uint64_t hd_offset, const unsigned long int i); #ifdef HAVE_NCURSES -static void fat_date_unix2dos(int unix_date,unsigned short *mstime, unsigned short *msdate); static int fat32_create_rootdir(disk_t *disk_car,const partition_t *partition, const unsigned int reserved, const unsigned int fat_length, const unsigned int root_cluster, const unsigned int sectors_per_cluster, const int verbose, file_info_t *rootdir_list, const unsigned int fats); static upart_type_t select_fat_info(const info_offset_t *info_offset, const unsigned int nbr_offset,unsigned int*reserved, unsigned int*fat_length, const unsigned long int max_sector_offset, unsigned int *fats); #endif @@ -562,7 +561,7 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t * #ifdef HAVE_NCURSES -static void fat_date_unix2dos(int unix_date,unsigned short *mstime, unsigned short *msdate) +static void fat_date_unix2dos(time_t unix_date,unsigned short *mstime, unsigned short *msdate) { static const int day_n[] = { 0,31,59,90,120,151,181,212,243,273,304,334,0,0,0,0 }; /* JanFebMarApr May Jun Jul Aug Sep Oct Nov Dec */ diff --git a/src/savehdr.c b/src/savehdr.c index 601eeee8..439a4e9c 100644 --- a/src/savehdr.c +++ b/src/savehdr.c @@ -216,7 +216,7 @@ int partition_save(disk_t *disk_car, const list_part_t *list_part, const int ver log_critical("Can't create backup.log file: %s\n",strerror(errno)); return -1; } - fprintf(f_backup,"#%u %s\n",(unsigned int)time(NULL), disk_car->description(disk_car)); + fprintf(f_backup,"#%lu %s\n",(unsigned long int)time(NULL), disk_car->description(disk_car)); for(parts=list_part;parts!=NULL;parts=parts->next) { char status='D'; diff --git a/src/sessionp.c b/src/sessionp.c index 78dd9fbd..12841eca 100644 --- a/src/sessionp.c +++ b/src/sessionp.c @@ -225,8 +225,8 @@ int session_save(const alloc_data_t *list_free_space, const struct ph_param *par { log_trace("session_save\n"); } - fprintf(f_session,"#%u\n%s %s,%u,", - (unsigned int)time(NULL), params->disk->device, params->disk->arch->part_name_option, params->partition->order); + fprintf(f_session,"#%lu\n%s %s,%u,", + (unsigned long int)time(NULL), params->disk->device, params->disk->arch->part_name_option, params->partition->order); if(params->blocksize>0) fprintf(f_session,"blocksize,%u,", params->blocksize); fprintf(f_session,"fileopt,");