Ignore:
Timestamp:
Dec 20, 2021, 11:51:05 PM (4 years ago)
Author:
bird
Message:

grep: Initial windows config and adjustments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/grep/lib/dup-safer-flag.c

    r3529 r3532  
    3434dup_safer_flag (int fd, int flag)
    3535{
     36#if defined(KMK_GREP) && defined(_MSC_VER)
     37  int afd[STDERR_FILENO + 1];
     38  int i;
     39  for (i = 0; ; i++)
     40    {
     41      int fdNew = _dup(fd);
     42      if (fdNew >= STDERR_FILENO + 1 || fdNew < 0)
     43        {
     44          while (i-- > 0)
     45            close(afd[i]);
     46          return fdNew;
     47        }
     48      afd[i] = fdNew;
     49    }
     50#else
    3651  return fcntl (fd, (flag & O_CLOEXEC) ? F_DUPFD_CLOEXEC : F_DUPFD,
    3752                STDERR_FILENO + 1);
     53#endif
    3854}
Note: See TracChangeset for help on using the changeset viewer.