mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-06 04:04:59 +00:00
Merge pull request #204 from versity/zab/remove_wordexp
Remove wordexp expansion of utils path argument
This commit is contained in:
@@ -7,7 +7,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <wordexp.h>
|
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
@@ -18,26 +17,15 @@
|
|||||||
|
|
||||||
static int open_path(char *path, int flags)
|
static int open_path(char *path, int flags)
|
||||||
{
|
{
|
||||||
wordexp_t exp_result;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = wordexp(path, &exp_result, WRDE_NOCMD | WRDE_SHOWERR | WRDE_UNDEF);
|
ret = open(path, flags);
|
||||||
if (ret) {
|
|
||||||
fprintf(stderr, "wordexp() failure for \"%s\": %d\n", path, ret);
|
|
||||||
ret = -EINVAL;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = open(exp_result.we_wordv[0], flags);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ret = -errno;
|
ret = -errno;
|
||||||
fprintf(stderr, "failed to open '%s': %s (%d)\n",
|
fprintf(stderr, "failed to open '%s': %s (%d)\n",
|
||||||
path, strerror(errno), errno);
|
path, strerror(errno), errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
wordfree(&exp_result);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user