version 1.31, 2015/10/31 08:13:58 |
version 1.32, 2015/11/10 22:29:33 |
|
|
if (args_has(self->args, 'a')) |
if (args_has(self->args, 'a')) |
flags = "ab"; |
flags = "ab"; |
|
|
xasprintf(&file, "%s/%s", cwd, path); |
if (*path == '/') |
if (realpath(file, resolved) == NULL) |
file = xstrdup(path); |
f = NULL; |
|
else |
else |
f = fopen(resolved, flags); |
xasprintf(&file, "%s/%s", cwd, path); |
|
if (realpath(file, resolved) == NULL) { |
|
cmdq_error(cmdq, "%s: %s", file, strerror(errno)); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
f = fopen(resolved, flags); |
free(file); |
free(file); |
if (f == NULL) { |
if (f == NULL) { |
cmdq_error(cmdq, "%s: %s", resolved, strerror(errno)); |
cmdq_error(cmdq, "%s: %s", resolved, strerror(errno)); |