mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-06-30 21:02:33 +02:00
ima-evm-utils: Fix file2bin stat and fopen relations
Check stat(2) return value, use fstat(2) to avoid race between stat() and fopen(), remove now unused get_filesize(). Fixes: CID 229889. Signed-off-by: Vitaly Chikunov <vt@altlinux.org> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:

committed by
Mimi Zohar

parent
9d52489bd3
commit
08a51e7460
@ -116,14 +116,6 @@ const char *get_hash_algo_by_id(int algo)
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
int get_filesize(const char *filename)
|
||||
{
|
||||
struct stat stats;
|
||||
/* Need to know the file length */
|
||||
stat(filename, &stats);
|
||||
return (int)stats.st_size;
|
||||
}
|
||||
|
||||
static inline off_t get_fdsize(int fd)
|
||||
{
|
||||
struct stat stats;
|
||||
|
Reference in New Issue
Block a user