diff --git a/lib/cmdline.c b/lib/cmdline.c index 1b3aebc0..69ce8246 100644 --- a/lib/cmdline.c +++ b/lib/cmdline.c @@ -391,18 +391,7 @@ static GLogLevelFlags VERBOSITY_TO_LOG_LEVEL[] = {[0] = G_LOG_LEVEL_CRITICAL, static bool rm_cmd_add_path(RmSession *session, bool is_prefd, int index, const char *path) { RmCfg *cfg = session->cfg; - - /* Open the current working directory as fd */ - if(session->current_dir_fd <= 0) { - session->current_dir_fd = rm_sys_open(cfg->iwd, R_OK); - if(session->current_dir_fd < 0) { - rm_log_warning_line(_("Can't open directory or file \"%s\": %s"), cfg->iwd, - strerror(errno)); - return FALSE; - } - } - - if(faccessat(session->current_dir_fd, path, R_OK, AT_EACCESS) != 0) { + if(faccessat(AT_FDCWD, path, R_OK, AT_EACCESS) != 0) { rm_log_warning_line(_("Can't open directory or file \"%s\": %s"), path, strerror(errno)); return FALSE; @@ -1215,10 +1204,6 @@ static bool rm_cmd_set_paths(RmSession *session, char **paths) { return false; } - if(session->current_dir_fd > 0) { - rm_sys_close(session->current_dir_fd); - } - return true; } diff --git a/lib/session.h b/lib/session.h index 9625f6c8..9d7a25bc 100644 --- a/lib/session.h +++ b/lib/session.h @@ -133,9 +133,6 @@ typedef struct RmSession { /* Version of the linux kernel (0 on other operating systems) */ int kernel_version[2]; - - /* Open fd to the current directory (only valid during cmdline parsing) */ - int current_dir_fd; } RmSession; /**