Flush and close file descriptor after write when extracting a file node;

Remove #include directives automatically added by editor which only
exist on Linux;
This commit is contained in:
Nathan Fisher 2023-09-22 10:16:53 -04:00
parent 2bc5861dc0
commit 349c9389dd

View file

@ -32,12 +32,10 @@
#include "haggis.h" #include "haggis.h"
#include "mq.h" #include "mq.h"
#include <asm-generic/errno-base.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <libgen.h> #include <libgen.h>
#include <limits.h> // PATH_MAX #include <limits.h> // PATH_MAX
#include <linux/limits.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> // uint<x>_t #include <stdint.h> // uint<x>_t
#include <sys/unistd.h> #include <sys/unistd.h>
@ -846,6 +844,8 @@ int haggis_extract_file(haggis_node *node, char *basedir) {
if (ret != len) { if (ret != len) {
return 2; return 2;
} }
fflush(fd);
fclose(fd);
free(path); free(path);
return 0; return 0;
} }