tempq: Close file if version check fails
We were returning right away if the file version check fails, without closing the file. This could cause future reads or writes to fail to open. Fixes #25: File version checking doesn't look quite right Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
7ff3dc92a0
commit
fea5da5c10
|
@ -62,14 +62,17 @@ void tempq_init(struct queue_ops *ops)
|
|||
unsigned int num, i;
|
||||
|
||||
file_init(&tempq_file, "deck", 1);
|
||||
if (!file_open(&tempq_file, OPEN_READ) || file_version(&tempq_file) < 1)
|
||||
if (!file_open(&tempq_file, OPEN_READ))
|
||||
return;
|
||||
if (file_version(&tempq_file) < 1)
|
||||
goto out;
|
||||
|
||||
file_readf(&tempq_file, "%u", &num);
|
||||
for (i = 0; i < num; i++) {
|
||||
queue = __tempq_read_queue();
|
||||
queue->q_ops = ops;
|
||||
}
|
||||
out:
|
||||
file_close(&tempq_file);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue