Skip to content

Commit

Permalink
Revert "cmdline: Try to workaround missing AT_FDCWD"
Browse files Browse the repository at this point in the history
This reverts commit 0be1927.
  • Loading branch information
sahib committed Apr 1, 2016
1 parent 6f84844 commit 77fa9b5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
17 changes: 1 addition & 16 deletions lib/cmdline.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
3 changes: 0 additions & 3 deletions lib/session.h
Expand Up @@ -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;

/**
Expand Down

0 comments on commit 77fa9b5

Please sign in to comment.