Skip to content

Commit f21d24b

Browse files
committed
check return value from dis_open() and exit early if open failed
1 parent 0a10558 commit f21d24b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/dislocker-metadata.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ int main(int argc, char **argv)
123123
/* Open the volume as a (big) normal file */
124124
dis_printf(L_DEBUG, "Trying to open '%s'...\n", volume_path);
125125
fve_fd = dis_open(volume_path, O_RDONLY|O_LARGEFILE);
126+
if (fve_fd < 0)
127+
{
128+
fprintf(stderr, "Failed to open volume %s, exiting.\n", volume_path);
129+
exit(EXIT_FAILURE);
130+
}
126131

127132
/*
128133
* Initialize dislocker's configuration

0 commit comments

Comments
 (0)