Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ if test x"$debug" = xyes; then
AC_DEFINE([DEBUG], [1], [Debug Flag])
fi

if test "x$sysconfdir" = 'x${prefix}/etc'; then
if test "x$prefix" = 'xNONE'; then
sysconfdir=$ac_default_prefix/etc
else
sysconfdir=$prefix/etc
fi
fi
AC_DEFINE_UNQUOTED([SYSCONFDIR], ["$sysconfdir"], [System Configuration Directory])

# Checks for programs.
AC_PROG_CC
Expand Down Expand Up @@ -150,7 +158,7 @@ for TMPVAR in creat creat64 fopen fopen64 freopen freopen64 open open64 rename u
do
VERSIONVAR=$(grep -m1 $TMPVAR@ glibc_symbols | cut -d@ -f2)
FUNCVAR=$(echo $TMPVAR | tr a-z A-Z)_VERSION

if test "x$VERSIONVAR" != "x" ; then
AC_DEFINE_UNQUOTED([$FUNCVAR],"$VERSIONVAR",[$TMPVAR Define for dlvsym call])
else
Expand All @@ -163,7 +171,7 @@ for TMPVAR in openat openat64 renameat unlinkat
do
VERSIONVAR=$(grep -m1 $TMPVAR@ glibc_symbols | cut -d@ -f2)
FUNCVAR=$(echo $TMPVAR | tr a-z A-Z)_VERSION

if test "x$VERSIONVAR" != "x" ; then
AC_DEFINE_UNQUOTED([$FUNCVAR],"$VERSIONVAR",[$TMPVAR Define for dlvsym call])
else
Expand Down
38 changes: 34 additions & 4 deletions src/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <dlfcn.h>
#include <limits.h>

#include "trash.h"

Expand Down Expand Up @@ -1437,12 +1438,41 @@ void get_config_from_file(config *cfg)
"IGNORE_RE",
"PRESERVE_FILES_LARGER_THAN");

/* Did read_config_from_file() fail? If it did, we quit and leave the compile-time defaults unchanged: */
if (!config_values) {
char sysconf_path[PATH_MAX];
snprintf(sysconf_path, sizeof(sysconf_path), "%s/libtrash.conf", SYSCONFDIR);
config_values = read_config_from_file(sysconf_path, NUMBER_OF_CONFIG_OPTIONS, cfg,
"TRASH_CAN",
"IN_CASE_OF_FAILURE",
"SHOULD_WARN",
"IGNORE_HIDDEN",
"IGNORE_EDITOR_BACKUP",
"PROTECT_TRASH",
"GLOBAL_PROTECTION",
"TRASH_SYSTEM_ROOT",
"TEMPORARY_DIRS",
"USER_TEMPORARY_DIRS",
"UNREMOVABLE_DIRS",
"IGNORE_EXTENSIONS",
"INTERCEPT_UNLINK",
"INTERCEPT_RENAME",
"INTERCEPT_FOPEN",
"INTERCEPT_FREOPEN",
"INTERCEPT_OPEN",
"LIBTRASH_CONFIG_FILE_UNREMOVABLE",
"REMOVABLE_MEDIA_MOUNT_POINTS",
"IGNORE_EDITOR_TEMPORARY",
"EXCEPTIONS",
"IGNORE_RE",
"PRESERVE_FILES_LARGER_THAN");

/* Did read_config_from_file() fail? If it did, we quit and leave the compile-time defaults unchanged: */

if (!config_values)
return;
if (!config_values)
return;
}

/* If we managed to read the configuration file in the user's home directory,
/* If we managed to read the configuration file in the user's home directory,
* we now proceed to set the configuration variables to the values read_config_from_file() returned to us: */

/* Configuration variables which are integers used as "flags" are set by the
Expand Down