futility/updater_archive.c
/* Callback for archive_read_file on a general file system. */
Callback for archive_read_file on a general file system.
Callback for archive_read_file on a general file system .
static int archive_fallback_read_file(void *handle, const char *fname,
				      uint8_t **data, uint32_t *size, int64_t *mtime)
{
	int r;
	char *temp_path = NULL;
	const char *path = archive_fallback_get_path(handle, fname, &temp_path);
	struct stat st;
	VB2_DEBUG("Reading %s\n", path);
	*data = NULL;
	*size = 0;
	r = vb2_read_file(path, data, size) != VB2_SUCCESS;
	if (mtime) {
		if (stat(path, &st) == 0)
			*mtime = st.st_mtime;
		else
			WARN("Unable to stat %s: %s\n", path, strerror(errno));
	}
	free(temp_path);
	return r;
}
static int archive_fallback_read_file ( void * handle , const char * fname , uint8_t * * data , uint32_t * size , int64_t * mtime ) { int r ; char * temp_path = NULL ; const char * path = archive_fallback_get_path ( handle , fname , & temp_path ) ; struct stat st ; VB2_DEBUG ( " \n " , path ) ; * data = NULL ; * size = 0 ; r = vb2_read_file ( path , data , size ) != VB2_SUCCESS ; if ( mtime ) { if ( stat ( path , & st ) == 0 ) * mtime = st . st_mtime ; else WARN ( " \n " , path , strerror ( errno ) ) ; } free ( temp_path ) ; return r ; }
Callback for archive_read_file on a general file system.
Callback for archive_read_file on a general file system .