*/
/*
- * Copyright (C) 2012-2016 Eric Biggers
+ * Copyright 2012-2023 Eric Biggers
*
* This file is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this file; if not, see http://www.gnu.org/licenses/.
+ * along with this file; if not, see https://www.gnu.org/licenses/.
*/
#ifdef HAVE_CONFIG_H
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
+#include <sys/stat.h>
#include <unistd.h>
#include "wimlib.h"
filedes_init(&wim->in_fd, *(const int*)wim_filename_or_fd);
wim->in_fd.is_pipe = 1;
} else {
+ struct stat stbuf;
+
wimfile = wim_filename_or_fd;
ret = open_wim_file(wimfile, &wim->in_fd);
if (ret)
return ret;
+ /* The file size is needed for enforcing some limits later. */
+ if (fstat(wim->in_fd.fd, &stbuf) == 0)
+ wim->file_size = stbuf.st_size;
+
/* The absolute path to the WIM is requested so that
* wimlib_overwrite() still works even if the process changes
* its working directory. This actually happens if a WIM is
goto out_unlock;
init_cpu_features();
- xml_global_init();
#ifdef _WIN32
ret = win32_global_init(init_flags);
if (ret)
if (!lib_initialized)
goto out_unlock;
- xml_global_cleanup();
#ifdef _WIN32
win32_global_cleanup();
#endif