Fixed reacting to missing plugin

When a plugin is missing, dlopen() does not set errno, which leads
to erratic behavior. Set errno as ELIBACC when this occurs.
This commit is contained in:
Jean-Pierre André 2019-01-23 17:33:15 +01:00
parent 96825f3c2b
commit facb697303
3 changed files with 12 additions and 7 deletions

View File

@ -1,9 +1,10 @@
/*
* compat.h - Tweaks for Windows compatibility.
* compat.h - Tweaks for compatibility with non-Linux systems.
*
* Copyright (c) 2002 Richard Russon
* Copyright (c) 2002-2004 Anton Altaparmakov
* Copyright (c) 2008-2009 Szabolcs Szakacsits
* Copyright (c) 2019 Jean-Pierre Andre
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@ -41,6 +42,10 @@
#define ELIBBAD ENOEXEC
#endif
#ifndef ELIBACC
#define ELIBACC ENOENT
#endif
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif

View File

@ -4,7 +4,7 @@
* Copyright (c) 2005-2007 Yura Pakhuchiy
* Copyright (c) 2005 Yuval Fledel
* Copyright (c) 2006-2009 Szabolcs Szakacsits
* Copyright (c) 2007-2017 Jean-Pierre Andre
* Copyright (c) 2007-2019 Jean-Pierre Andre
* Copyright (c) 2009 Erik Larsson
*
* This file is originated from the Linux-NTFS project.
@ -263,7 +263,7 @@ static const char *usage_msg =
"\n"
"Copyright (C) 2005-2007 Yura Pakhuchiy\n"
"Copyright (C) 2006-2009 Szabolcs Szakacsits\n"
"Copyright (C) 2007-2017 Jean-Pierre Andre\n"
"Copyright (C) 2007-2019 Jean-Pierre Andre\n"
"Copyright (C) 2009 Erik Larsson\n"
"\n"
"Usage: %s [-o option[,...]] <device|image_file> <mount_point>\n"
@ -1074,10 +1074,9 @@ static void ntfs_fuse_readlink(fuse_req_t req, fuse_ino_t ino)
REPARSE_POINT *reparse;
res = CALL_REPARSE_PLUGIN(ni, readlink, &buf);
if (res) {
if (res || !buf) {
buf = strdup(ntfs_bad_reparse);
if (!buf)
res = -errno;
res = (buf ? 0 : -errno);
}
#else /* DISABLE_PLUGINS */
errno = 0;

View File

@ -1,7 +1,7 @@
/**
* ntfs-3g_common.c - Common definitions for ntfs-3g and lowntfs-3g.
*
* Copyright (c) 2010-2018 Jean-Pierre Andre
* Copyright (c) 2010-2019 Jean-Pierre Andre
* Copyright (c) 2010 Erik Larsson
*
* This program/include file is free software; you can redistribute it and/or
@ -841,6 +841,7 @@ const struct plugin_operations *select_reparse_plugin(ntfs_fuse_context_t *ctx,
if (!ops)
dlclose(handle);
} else {
errno = ELIBACC;
if (!(ctx->errors_logged & ERR_PLUGIN)) {
ntfs_log_perror(
"Could not load plugin %s",