File ChangeLog changed (mode: 100644) (index d231da65e..5c682cddd) |
79 |
79 |
Fixed user-specific trash directory (absolute path, `%u` and no `%r`) |
Fixed user-specific trash directory (absolute path, `%u` and no `%r`) |
80 |
80 |
created on setting 'trashdir' not having reduced set of permissions. |
created on setting 'trashdir' not having reduced set of permissions. |
81 |
81 |
|
|
|
82 |
|
Fixed treating a failure to create a trash directory on a read-only |
|
83 |
|
file-system in a Unix environment as a success. Thanks to feekApp. |
|
84 |
|
|
82 |
85 |
0.14-beta to 0.14 (2025-02-08) |
0.14-beta to 0.14 (2025-02-08) |
83 |
86 |
|
|
84 |
87 |
Improved documentation on zh/zl menu keys a bit. |
Improved documentation on zh/zl menu keys a bit. |
File src/trash.c changed (mode: 100644) (index d5016db29..3746e5ed7) |
... |
... |
get_list_of_trashes_traverser_state; |
92 |
92 |
|
|
93 |
93 |
static int validate_spec(const char spec[]); |
static int validate_spec(const char spec[]); |
94 |
94 |
static int create_trash_dir(const char trash_dir[], int user_specific); |
static int create_trash_dir(const char trash_dir[], int user_specific); |
95 |
|
static int try_create_trash_dir(const char trash_dir[], int user_specific); |
|
|
95 |
|
static int try_create_trash_dir(const char trash_dir[], int user_specific, |
|
96 |
|
int interactive); |
96 |
97 |
static void empty_trash_dirs(void); |
static void empty_trash_dirs(void); |
97 |
98 |
static void empty_trash_dir(const char trash_dir[], int can_delete); |
static void empty_trash_dir(const char trash_dir[], int can_delete); |
98 |
99 |
static void empty_trash_in_bg(bg_op_t *bg_op, void *arg); |
static void empty_trash_in_bg(bg_op_t *bg_op, void *arg); |
|
... |
... |
create_trash_dir(const char trash_dir[], int user_specific) |
220 |
221 |
{ |
{ |
221 |
222 |
LOG_FUNC_ENTER; |
LOG_FUNC_ENTER; |
222 |
223 |
|
|
223 |
|
if(try_create_trash_dir(trash_dir, user_specific) != 0) |
|
|
224 |
|
if(try_create_trash_dir(trash_dir, user_specific, /*interactive=*/1) != 0) |
224 |
225 |
{ |
{ |
225 |
226 |
show_error_msgf("Error Setting Trash Directory", |
show_error_msgf("Error Setting Trash Directory", |
226 |
227 |
"Could not set trash directory to %s: %s", trash_dir, strerror(errno)); |
"Could not set trash directory to %s: %s", trash_dir, strerror(errno)); |
|
... |
... |
create_trash_dir(const char trash_dir[], int user_specific) |
233 |
234 |
/* Tries to create trash directory. Returns zero on success, otherwise non-zero |
/* Tries to create trash directory. Returns zero on success, otherwise non-zero |
234 |
235 |
* value is returned. */ |
* value is returned. */ |
235 |
236 |
static int |
static int |
236 |
|
try_create_trash_dir(const char trash_dir[], int user_specific) |
|
|
237 |
|
try_create_trash_dir(const char trash_dir[], int user_specific, int interactive) |
237 |
238 |
{ |
{ |
238 |
239 |
LOG_FUNC_ENTER; |
LOG_FUNC_ENTER; |
239 |
240 |
|
|
|
... |
... |
try_create_trash_dir(const char trash_dir[], int user_specific) |
242 |
243 |
if(make_path(trash_dir, 0777) != 0) |
if(make_path(trash_dir, 0777) != 0) |
243 |
244 |
{ |
{ |
244 |
245 |
#ifndef _WIN32 |
#ifndef _WIN32 |
245 |
|
/* Do not treat it as an error if trash is not writable because |
|
246 |
|
* file-system is mounted read-only. User should be aware of it. */ |
|
247 |
|
return (errno != EROFS); |
|
248 |
|
#else |
|
249 |
|
return 1; |
|
|
246 |
|
if(interactive) |
|
247 |
|
{ |
|
248 |
|
/* Do not treat it as an error if the trash is not writable because |
|
249 |
|
* file-system is mounted read-only. User should be aware of it. */ |
|
250 |
|
return (errno != EROFS); |
|
251 |
|
} |
250 |
252 |
#endif |
#endif |
251 |
253 |
} |
} |
252 |
254 |
} |
} |
|
... |
... |
static int |
684 |
686 |
pick_trash_dir_traverser(const char base_path[], const char trash_dir[], |
pick_trash_dir_traverser(const char base_path[], const char trash_dir[], |
685 |
687 |
int user_specific, void *arg) |
int user_specific, void *arg) |
686 |
688 |
{ |
{ |
687 |
|
if(try_create_trash_dir(trash_dir, user_specific) == 0) |
|
|
689 |
|
if(try_create_trash_dir(trash_dir, user_specific, /*interactive=*/0) == 0) |
688 |
690 |
{ |
{ |
689 |
691 |
char **const result = arg; |
char **const result = arg; |
690 |
692 |
*result = strdup(trash_dir); |
*result = strdup(trash_dir); |