#include <stdlib.h>
#include <unistd.h>
#include <zip.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
#include <glib.h>
#include <glib/gstdio.h>
#include "config.h" /* Needed for PACKAGE_VERSION and others. */
/** @private */
SR_PRIV int sr_sessionfile_check(const char *filename)
{
+ struct stat st;
struct zip *archive;
struct zip_file *zf;
struct zip_stat zs;
if (!filename)
return SR_ERR_ARG;
+ if (stat(filename, &st) == -1) {
+ sr_err("Couldn't stat %s: %s", filename, strerror(errno));
+ return SR_ERR;
+ }
+
if (!(archive = zip_open(filename, 0, &ret)))
/* No logging: this can be used just to check if it's
* a sigrok session file or not. */