mirror of
https://github.com/vale981/yabar
synced 2025-03-04 17:11:38 -05:00
close potential opened files before intern blk thread exist
This commit is contained in:
parent
9f22bd72d1
commit
cafb98bea6
1 changed files with 10 additions and 0 deletions
|
@ -231,6 +231,11 @@ void ya_int_bandwidth(ya_block_t * blk) {
|
|||
fprintf(stderr, "Error opening file %s or %s\n", rxpath, txpath);
|
||||
strncpy(blk->buf, "BLOCK ERROR!", strlen("BLOCK ERROR!"));
|
||||
ya_draw_pango_text(blk);
|
||||
//Close if one of the files is opened
|
||||
if(rxfile)
|
||||
fclose(rxfile);
|
||||
if(txfile)
|
||||
fclose(txfile);
|
||||
pthread_detach(blk->thread);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
@ -454,6 +459,11 @@ void ya_int_battery(ya_block_t *blk) {
|
|||
fprintf(stderr, "Error opening file %s or %s\n", cpath, spath);
|
||||
strncpy(blk->buf, "BLOCK ERROR!", strlen("BLOCK ERROR!"));
|
||||
ya_draw_pango_text(blk);
|
||||
//Close if one of the files is opened
|
||||
if(cfile)
|
||||
fclose(cfile);
|
||||
if(sfile)
|
||||
fclose(sfile);
|
||||
pthread_detach(blk->thread);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue