Revert "Tighten up empty string checks."

The use of wcstoimax causes certain out-of-range values
to be silently truncated (e.g. when converted to a pid),
and is incompatible with FreeBSD (see #626)

This reverts commit 6faa2f9866.
This commit is contained in:
ridiculousfish
2016-10-01 17:21:40 -07:00
parent b05c09429d
commit d17f2585fa
8 changed files with 275 additions and 235 deletions

View File

@@ -13,8 +13,6 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <inttypes.h>
#include <termios.h>
#include <unistd.h>
#include <wchar.h>
@@ -1002,8 +1000,8 @@ bool parse_execution_context_t::determine_io_chain(const parse_node_t &statement
} else {
wchar_t *end = NULL;
errno = 0;
int old_fd = wcstoimax(target.c_str(), &end, 10);
if (old_fd < 0 || errno || *end != L'\0') {
int old_fd = fish_wcstoi(target.c_str(), &end, 10);
if (old_fd < 0 || errno || *end) {
errored =
report_error(redirect_node, _(L"Requested redirection to '%ls', which "
L"is not a valid file descriptor"),