Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch bug-3598300 Excluding Merge-Ins
This is equivalent to a diff from 28d93383bb to 8b4e89b6a1
|
2019-07-05
| ||
| 13:34 | Fix [4718b41c56d8c135] for win32. Now timestamps on Win32 can be > 19 january 2038. Caveat: Now Tcl ... check-in: c77dd686a6 user: jan.nijtmans tags: trunk | |
| 13:21 | Merge trunk Leaf check-in: 8b4e89b6a1 user: jan.nijtmans tags: bug-3598300 | |
| 12:12 | Merge 8.7 check-in: 28d93383bb user: jan.nijtmans tags: trunk | |
| 12:11 | Merge 8.6 check-in: 4d008d1ead user: jan.nijtmans tags: core-8-branch | |
|
2019-07-03
| ||
| 15:29 | Merge 8.7 check-in: b50062c656 user: jan.nijtmans tags: trunk | |
|
2018-05-15
| ||
| 19:47 | Re-base novem-bug-3598300 branch to trunk, going further as bug-3598300. "configure" not re-generate... check-in: 65118675f3 user: jan.nijtmans tags: bug-3598300 | |
Changes to generic/tcl.h.
| ︙ | ︙ | |||
236 237 238 239 240 241 242 | # define TCL_WIDE_INT_IS_LONG 1 # define TCL_CFG_DO64BIT 1 # else /* !__LP64__ */ # define TCL_WIDE_INT_TYPE long long # undef TCL_WIDE_INT_IS_LONG # undef TCL_CFG_DO64BIT # endif /* __LP64__ */ | < | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | # define TCL_WIDE_INT_IS_LONG 1 # define TCL_CFG_DO64BIT 1 # else /* !__LP64__ */ # define TCL_WIDE_INT_TYPE long long # undef TCL_WIDE_INT_IS_LONG # undef TCL_CFG_DO64BIT # endif /* __LP64__ */ #endif /* __APPLE__ */ /* * Define Tcl_WideInt to be a type that is (at least) 64-bits wide, and define * Tcl_WideUInt to be the unsigned variant of that type (assuming that where * we have one, we can have the other.) * |
| ︙ | ︙ | |||
304 305 306 307 308 309 310 | #endif /* !TCL_Z_MODIFIER */ #define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) #define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) #define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) #define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) #if defined(_WIN32) | < < < | < < < < < | | | < < < | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
#endif /* !TCL_Z_MODIFIER */
#define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val)))
#define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val)))
#define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val)))
#define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val)))
#if defined(_WIN32)
typedef struct __stat64 Tcl_StatBuf;
#elif defined(__CYGWIN__)
typedef struct {
dev_t st_dev;
unsigned short st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
/* Here is a 2-byte gap */
dev_t st_rdev;
/* Here is a 4-byte gap */
long long st_size;
struct {long long tv_sec;} st_atim;
struct {long long tv_sec;} st_mtim;
struct {long long tv_sec;} st_ctim;
} Tcl_StatBuf;
#else
typedef struct stat Tcl_StatBuf;
#endif
/*
*----------------------------------------------------------------------------
* Data structures defined opaquely in this module. The definitions below just
|
| ︙ | ︙ |
Changes to generic/tclBasic.c.
| ︙ | ︙ | |||
635 636 637 638 639 640 641 |
if (sizeof(Tcl_CallFrame) < sizeof(CallFrame)) {
/*NOTREACHED*/
Tcl_Panic("Tcl_CallFrame must not be smaller than CallFrame");
}
#if defined(_WIN32) && !defined(_WIN64)
| | | | | | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 |
if (sizeof(Tcl_CallFrame) < sizeof(CallFrame)) {
/*NOTREACHED*/
Tcl_Panic("Tcl_CallFrame must not be smaller than CallFrame");
}
#if defined(_WIN32) && !defined(_WIN64)
if (sizeof(time_t) != 8) {
/*NOTREACHED*/
Tcl_Panic("<time.h> is not compatible with VS2005+");
}
if ((offsetof(Tcl_StatBuf,st_atime) != 32)
|| (offsetof(Tcl_StatBuf,st_ctime) != 48)) {
/*NOTREACHED*/
Tcl_Panic("<sys/stat.h> is not compatible with VS2005+");
}
#endif
if (cancelTableInitialized == 0) {
Tcl_MutexLock(&cancelLock);
if (cancelTableInitialized == 0) {
Tcl_InitHashTable(&cancelTable, TCL_ONE_WORD_KEYS);
|
| ︙ | ︙ |
Changes to unix/configure.
| ︙ | ︙ | |||
6904 6905 6906 6907 6908 6909 6910 |
cat >>confdefs.h <<_ACEOF
#define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit}
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${tcl_cv_type_64bit}" >&5
$as_echo "${tcl_cv_type_64bit}" >&6; }
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 |
cat >>confdefs.h <<_ACEOF
#define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit}
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${tcl_cv_type_64bit}" >&5
$as_echo "${tcl_cv_type_64bit}" >&6; }
fi
#--------------------------------------------------------------------
# Check endianness because we can optimize comparisons of
# Tcl_UniChar strings to memcmp on big-endian systems.
#--------------------------------------------------------------------
|
| ︙ | ︙ |
Changes to unix/tcl.m4.
| ︙ | ︙ | |||
2360 2361 2362 2363 2364 2365 2366 | # None # # Results: # # Might define the following vars: # TCL_WIDE_INT_IS_LONG # TCL_WIDE_INT_TYPE | < < < | 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 |
# None
#
# Results:
#
# Might define the following vars:
# TCL_WIDE_INT_IS_LONG
# TCL_WIDE_INT_TYPE
#
#--------------------------------------------------------------------
AC_DEFUN([SC_TCL_64BIT_FLAGS], [
AC_MSG_CHECKING([for 64-bit integer type])
AC_CACHE_VAL(tcl_cv_type_64bit,[
tcl_cv_type_64bit=none
|
| ︙ | ︙ | |||
2386 2387 2388 2389 2390 2391 2392 |
if test "${tcl_cv_type_64bit}" = none ; then
AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?])
AC_MSG_RESULT([yes])
else
AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
[What type should be used to define wide integers?])
AC_MSG_RESULT([${tcl_cv_type_64bit}])
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 |
if test "${tcl_cv_type_64bit}" = none ; then
AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?])
AC_MSG_RESULT([yes])
else
AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
[What type should be used to define wide integers?])
AC_MSG_RESULT([${tcl_cv_type_64bit}])
fi
])
#--------------------------------------------------------------------
# SC_TCL_CFG_ENCODING TIP #59
#
# Declare the encoding to use for embedded configuration information.
|
| ︙ | ︙ |
Changes to unix/tclConfig.h.in.
| ︙ | ︙ | |||
192 193 194 195 196 197 198 | /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if the system has the type `struct addrinfo'. */ #undef HAVE_STRUCT_ADDRINFO | < < < < < < | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if the system has the type `struct addrinfo'. */ #undef HAVE_STRUCT_ADDRINFO /* Define to 1 if the system has the type `struct in6_addr'. */ #undef HAVE_STRUCT_IN6_ADDR /* Define to 1 if the system has the type `struct sockaddr_in6'. */ #undef HAVE_STRUCT_SOCKADDR_IN6 /* Define to 1 if the system has the type `struct sockaddr_storage'. */ #undef HAVE_STRUCT_SOCKADDR_STORAGE /* Define to 1 if `st_blksize' is member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE /* Define to 1 if `st_blocks' is member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLOCKS /* Define to 1 if you have the <sys/filio.h> header file. */ |
| ︙ | ︙ | |||
249 250 251 252 253 254 255 | /* Should we use the tm_gmtoff field of struct tm? */ #undef HAVE_TM_GMTOFF /* Should we use the tm_tzadj field of struct tm? */ #undef HAVE_TM_TZADJ | < < < | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | /* Should we use the tm_gmtoff field of struct tm? */ #undef HAVE_TM_GMTOFF /* Should we use the tm_tzadj field of struct tm? */ #undef HAVE_TM_TZADJ /* Do we have the uintptr_t type? */ #undef HAVE_UINTPTR_T /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `waitpid' function. */ |
| ︙ | ︙ |
Changes to unix/tclUnixChan.c.
| ︙ | ︙ | |||
444 445 446 447 448 449 450 |
FileState *fsPtr = instanceData;
Tcl_WideInt oldLoc, newLoc;
/*
* Save our current place in case we need to roll-back the seek.
*/
| | | | | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 |
FileState *fsPtr = instanceData;
Tcl_WideInt oldLoc, newLoc;
/*
* Save our current place in case we need to roll-back the seek.
*/
oldLoc = lseek(fsPtr->fd, (off_t) 0, SEEK_CUR);
if (oldLoc == -1) {
/*
* Bad things are happening. Error out...
*/
*errorCodePtr = errno;
return -1;
}
newLoc = lseek(fsPtr->fd, (off_t) offset, mode);
/*
* Check for expressability in our return type, and roll-back otherwise.
*/
if (newLoc > INT_MAX) {
*errorCodePtr = EOVERFLOW;
lseek(fsPtr->fd, (off_t) oldLoc, SEEK_SET);
return -1;
} else {
*errorCodePtr = (newLoc == -1) ? errno : 0;
}
return (int) newLoc;
}
|
| ︙ | ︙ | |||
501 502 503 504 505 506 507 |
int mode, /* Relative to where should we seek? Can be
* one of SEEK_START, SEEK_CUR or SEEK_END. */
int *errorCodePtr) /* To store error code. */
{
FileState *fsPtr = instanceData;
Tcl_WideInt newLoc;
| | | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
int mode, /* Relative to where should we seek? Can be
* one of SEEK_START, SEEK_CUR or SEEK_END. */
int *errorCodePtr) /* To store error code. */
{
FileState *fsPtr = instanceData;
Tcl_WideInt newLoc;
newLoc = lseek(fsPtr->fd, (off_t) offset, mode);
*errorCodePtr = (newLoc == -1) ? errno : 0;
return newLoc;
}
/*
*----------------------------------------------------------------------
|
| ︙ | ︙ | |||
1662 1663 1664 1665 1666 1667 1668 |
return NULL;
}
#ifdef DJGPP
SET_BITS(mode, O_BINARY);
#endif
| | | 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 |
return NULL;
}
#ifdef DJGPP
SET_BITS(mode, O_BINARY);
#endif
fd = open(native, mode, permissions);
if (fd < 0) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't open \"%s\": %s",
TclGetString(pathPtr), Tcl_PosixError(interp)));
}
|
| ︙ | ︙ | |||
1843 1844 1845 1846 1847 1848 1849 |
int mode = 0; /* compiler warning (used before set). */
const char *bufMode = NULL;
/*
* Some #def's to make the code a little clearer!
*/
| | | | | | | 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 |
int mode = 0; /* compiler warning (used before set). */
const char *bufMode = NULL;
/*
* Some #def's to make the code a little clearer!
*/
#define ZERO_OFFSET ((off_t) 0)
#define ERROR_OFFSET ((off_t) -1)
switch (type) {
case TCL_STDIN:
if ((lseek(0, ZERO_OFFSET, SEEK_CUR) == ERROR_OFFSET)
&& (errno == EBADF)) {
return NULL;
}
fd = 0;
mode = TCL_READABLE;
bufMode = "line";
break;
case TCL_STDOUT:
if ((lseek(1, ZERO_OFFSET, SEEK_CUR) == ERROR_OFFSET)
&& (errno == EBADF)) {
return NULL;
}
fd = 1;
mode = TCL_WRITABLE;
bufMode = "line";
break;
case TCL_STDERR:
if ((lseek(2, ZERO_OFFSET, SEEK_CUR) == ERROR_OFFSET)
&& (errno == EBADF)) {
return NULL;
}
fd = 2;
mode = TCL_WRITABLE;
bufMode = "none";
break;
|
| ︙ | ︙ | |||
2029 2030 2031 2032 2033 2034 2035 |
FileTruncateProc(
ClientData instanceData,
Tcl_WideInt length)
{
FileState *fsPtr = instanceData;
int result;
| < < < < < < < < | 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 |
FileTruncateProc(
ClientData instanceData,
Tcl_WideInt length)
{
FileState *fsPtr = instanceData;
int result;
result = ftruncate(fsPtr->fd, (off_t) length);
if (result) {
return errno;
}
return 0;
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
|
Changes to unix/tclUnixFCmd.c.
| ︙ | ︙ | |||
267 268 269 270 271 272 273 | # define haveRealpath (tclMacOSXDarwinRelease >= 7) #else # define haveRealpath 1 #endif #endif /* NO_REALPATH */ #ifdef HAVE_FTS | < < < | | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | # define haveRealpath (tclMacOSXDarwinRelease >= 7) #else # define haveRealpath 1 #endif #endif /* NO_REALPATH */ #ifdef HAVE_FTS #if defined(__APPLE__) && defined(__LP64__) && \ defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \ MAC_OS_X_VERSION_MIN_REQUIRED < 1050 /* * Prior to Darwin 9, 64bit fts_open() without FTS_NOSTAT may crash (due to a * 64bit-unsafe ALIGN macro); if we could be running on pre-10.5 OSX, check * Darwin release at runtime and do a separate stat() if necessary. */ |
| ︙ | ︙ | |||
363 364 365 366 367 368 369 |
* as EINVAL instead of EEXIST (first rule out the correct EINVAL result
* code for moving a directory into itself). Must be conditionally
* compiled because realpath() not defined on all systems.
*/
if (errno == EINVAL && haveRealpath) {
char srcPath[MAXPATHLEN], dstPath[MAXPATHLEN];
| | | | | | | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
* as EINVAL instead of EEXIST (first rule out the correct EINVAL result
* code for moving a directory into itself). Must be conditionally
* compiled because realpath() not defined on all systems.
*/
if (errno == EINVAL && haveRealpath) {
char srcPath[MAXPATHLEN], dstPath[MAXPATHLEN];
DIR *dirPtr;
struct dirent *dirEntPtr;
if ((Realpath((char *) src, srcPath) != NULL) /* INTL: Native. */
&& (Realpath((char *) dst, dstPath) != NULL) /* INTL: Native */
&& (strncmp(srcPath, dstPath, strlen(srcPath)) != 0)) {
dirPtr = opendir(dst); /* INTL: Native. */
if (dirPtr != NULL) {
while (1) {
dirEntPtr = readdir(dirPtr); /* INTL: Native. */
if (dirEntPtr == NULL) {
break;
}
if ((strcmp(dirEntPtr->d_name, ".") != 0) &&
(strcmp(dirEntPtr->d_name, "..") != 0)) {
errno = EEXIST;
closedir(dirPtr);
return TCL_ERROR;
}
}
closedir(dirPtr);
}
}
errno = EINVAL;
}
#endif /* !NO_REALPATH */
if (strcmp(src, "/") == 0) {
|
| ︙ | ︙ | |||
560 561 562 563 564 565 566 | #define BINMODE |O_BINARY #else #define BINMODE #endif /* DJGPP */ #define DEFAULT_COPY_BLOCK_SIZE 4096 | | | | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
#define BINMODE |O_BINARY
#else
#define BINMODE
#endif /* DJGPP */
#define DEFAULT_COPY_BLOCK_SIZE 4096
if ((srcFd = open(src, O_RDONLY BINMODE, 0)) < 0) { /* INTL: Native */
return TCL_ERROR;
}
dstFd = open(dst, O_CREAT|O_TRUNC|O_WRONLY BINMODE, /* INTL: Native */
statBufPtr->st_mode);
if (dstFd < 0) {
close(srcFd);
return TCL_ERROR;
}
/*
|
| ︙ | ︙ | |||
958 959 960 961 962 963 964 |
{
Tcl_StatBuf statBuf;
const char *source, *errfile;
int result;
size_t targetLen, sourceLen;
#ifndef HAVE_FTS
int numProcessed = 0;
| | | | 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 |
{
Tcl_StatBuf statBuf;
const char *source, *errfile;
int result;
size_t targetLen, sourceLen;
#ifndef HAVE_FTS
int numProcessed = 0;
struct dirent *dirEntPtr;
DIR *dirPtr;
#else
const char *paths[2] = {NULL, NULL};
FTS *fts = NULL;
FTSENT *ent;
#endif
errfile = NULL;
|
| ︙ | ︙ | |||
984 985 986 987 988 989 990 |
* Process the regular file
*/
return traverseProc(sourcePtr, targetPtr, &statBuf, DOTREE_F,
errorPtr);
}
#ifndef HAVE_FTS
| | | | | 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 |
* Process the regular file
*/
return traverseProc(sourcePtr, targetPtr, &statBuf, DOTREE_F,
errorPtr);
}
#ifndef HAVE_FTS
dirPtr = opendir(source); /* INTL: Native. */
if (dirPtr == NULL) {
/*
* Can't read directory
*/
errfile = source;
goto end;
}
result = traverseProc(sourcePtr, targetPtr, &statBuf, DOTREE_PRED,
errorPtr);
if (result != TCL_OK) {
closedir(dirPtr);
return result;
}
TclDStringAppendLiteral(sourcePtr, "/");
sourceLen = Tcl_DStringLength(sourcePtr);
if (targetPtr != NULL) {
TclDStringAppendLiteral(targetPtr, "/");
targetLen = Tcl_DStringLength(targetPtr);
}
while ((dirEntPtr = readdir(dirPtr)) != NULL) { /* INTL: Native. */
if ((dirEntPtr->d_name[0] == '.')
&& ((dirEntPtr->d_name[1] == '\0')
|| (strcmp(dirEntPtr->d_name, "..") == 0))) {
continue;
}
/*
|
| ︙ | ︙ | |||
1046 1047 1048 1049 1050 1051 1052 |
if (doRewind && (numProcessed > MAX_READDIR_UNLINK_THRESHOLD)) {
/*
* Call rewinddir if we've called unlink or rmdir so many times
* (since the opendir or the previous rewinddir), to avoid a
* NULL-return that may a symptom of a buggy readdir.
*/
| | | | 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 |
if (doRewind && (numProcessed > MAX_READDIR_UNLINK_THRESHOLD)) {
/*
* Call rewinddir if we've called unlink or rmdir so many times
* (since the opendir or the previous rewinddir), to avoid a
* NULL-return that may a symptom of a buggy readdir.
*/
rewinddir(dirPtr);
numProcessed = 0;
}
}
closedir(dirPtr);
/*
* Strip off the trailing slash we added
*/
Tcl_DStringSetLength(sourcePtr, sourceLen - 1);
if (targetPtr != NULL) {
|
| ︙ | ︙ |
Changes to unix/tclUnixFile.c.
| ︙ | ︙ | |||
255 256 257 258 259 260 261 |
matchResult = NativeMatchType(interp, native, nativeTail, types);
if (matchResult == 1) {
Tcl_ListObjAppendElement(interp, resultPtr, pathPtr);
}
Tcl_DecrRefCount(tailPtr);
Tcl_DecrRefCount(fileNamePtr);
} else {
| | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
matchResult = NativeMatchType(interp, native, nativeTail, types);
if (matchResult == 1) {
Tcl_ListObjAppendElement(interp, resultPtr, pathPtr);
}
Tcl_DecrRefCount(tailPtr);
Tcl_DecrRefCount(fileNamePtr);
} else {
DIR *d;
struct dirent *entryPtr;
const char *dirName;
size_t dirLength, nativeDirLen;
int matchHidden, matchHiddenPat;
Tcl_StatBuf statBuf;
Tcl_DString ds; /* native encoding of dir */
Tcl_DString dsOrig; /* utf-8 encoding of dir */
|
| ︙ | ︙ | |||
305 306 307 308 309 310 311 |
|| !S_ISDIR(statBuf.st_mode)) {
Tcl_DStringFree(&dsOrig);
Tcl_DStringFree(&ds);
Tcl_DecrRefCount(fileNamePtr);
return TCL_OK;
}
| | | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
|| !S_ISDIR(statBuf.st_mode)) {
Tcl_DStringFree(&dsOrig);
Tcl_DStringFree(&ds);
Tcl_DecrRefCount(fileNamePtr);
return TCL_OK;
}
d = opendir(native); /* INTL: Native. */
if (d == NULL) {
Tcl_DStringFree(&ds);
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't read directory \"%s\": %s",
Tcl_DStringValue(&dsOrig), Tcl_PosixError(interp)));
}
|
| ︙ | ︙ | |||
328 329 330 331 332 333 334 | * Check to see if -type or the pattern requests hidden files. */ matchHiddenPat = (pattern[0] == '.') || ((pattern[0] == '\\') && (pattern[1] == '.')); matchHidden = matchHiddenPat || (types && (types->perm & TCL_GLOB_PERM_HIDDEN)); | | | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
* Check to see if -type or the pattern requests hidden files.
*/
matchHiddenPat = (pattern[0] == '.')
|| ((pattern[0] == '\\') && (pattern[1] == '.'));
matchHidden = matchHiddenPat
|| (types && (types->perm & TCL_GLOB_PERM_HIDDEN));
while ((entryPtr = readdir(d)) != NULL) { /* INTL: Native. */
Tcl_DString utfDs;
const char *utfname;
/*
* Skip this file if it doesn't agree with the hidden parameters
* requested by the user (via -type or pattern).
*/
|
| ︙ | ︙ | |||
383 384 385 386 387 388 389 |
}
Tcl_DStringFree(&utfDs);
if (matchResult < 0) {
break;
}
}
| | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
}
Tcl_DStringFree(&utfDs);
if (matchResult < 0) {
break;
}
}
closedir(d);
Tcl_DStringFree(&ds);
Tcl_DStringFree(&dsOrig);
Tcl_DecrRefCount(fileNamePtr);
}
if (matchResult < 0) {
return TCL_ERROR;
}
|
| ︙ | ︙ |
Changes to unix/tclUnixInit.c.
| ︙ | ︙ | |||
358 359 360 361 362 363 364 |
tclPlatform = TCL_PLATFORM_UNIX;
#endif
/*
* Make sure, that the standard FDs exist. [Bug 772288]
*/
| | | | | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
tclPlatform = TCL_PLATFORM_UNIX;
#endif
/*
* Make sure, that the standard FDs exist. [Bug 772288]
*/
if (lseek(0, (off_t) 0, SEEK_CUR) == -1 && errno == EBADF) {
open("/dev/null", O_RDONLY);
}
if (lseek(1, (off_t) 0, SEEK_CUR) == -1 && errno == EBADF) {
open("/dev/null", O_WRONLY);
}
if (lseek(2, (off_t) 0, SEEK_CUR) == -1 && errno == EBADF) {
open("/dev/null", O_WRONLY);
}
/*
* The code below causes SIGPIPE (broken pipe) errors to be ignored. This
* is needed so that Tcl processes don't die if they create child
* processes (e.g. using "exec" or "open") that terminate prematurely.
|
| ︙ | ︙ |
Changes to unix/tclUnixPipe.c.
| ︙ | ︙ | |||
138 139 140 141 142 143 144 |
int mode) /* In what mode to open the file? */
{
int fd;
const char *native;
Tcl_DString ds;
native = Tcl_UtfToExternalDString(NULL, fname, -1, &ds);
| | | | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
int mode) /* In what mode to open the file? */
{
int fd;
const char *native;
Tcl_DString ds;
native = Tcl_UtfToExternalDString(NULL, fname, -1, &ds);
fd = open(native, mode, 0666); /* INTL: Native. */
Tcl_DStringFree(&ds);
if (fd != -1) {
fcntl(fd, F_SETFD, FD_CLOEXEC);
/*
* If the file is being opened for writing, seek to the end so we can
* append to any data already in the file.
*/
if ((mode & O_WRONLY) && !(mode & O_APPEND)) {
lseek(fd, (off_t) 0, SEEK_END);
}
/*
* Increment the fd so it can't be 0, which would conflict with the
* NULL return for errors.
*/
|
| ︙ | ︙ | |||
201 202 203 204 205 206 207 |
native = Tcl_UtfToExternalDString(NULL, contents, -1, &dstring);
if (write(fd, native, Tcl_DStringLength(&dstring)) == -1) {
close(fd);
Tcl_DStringFree(&dstring);
return NULL;
}
Tcl_DStringFree(&dstring);
| | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
native = Tcl_UtfToExternalDString(NULL, contents, -1, &dstring);
if (write(fd, native, Tcl_DStringLength(&dstring)) == -1) {
close(fd);
Tcl_DStringFree(&dstring);
return NULL;
}
Tcl_DStringFree(&dstring);
lseek(fd, (off_t) 0, SEEK_SET);
}
return MakeFile(fd);
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ |
Changes to unix/tclUnixPort.h.
| ︙ | ︙ | |||
52 53 54 55 56 57 58 | /* *--------------------------------------------------------------------------- * Parameterize for 64-bit filesystem support. *--------------------------------------------------------------------------- */ | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
/*
*---------------------------------------------------------------------------
* Parameterize for 64-bit filesystem support.
*---------------------------------------------------------------------------
*/
#ifdef __CYGWIN__
/* Make some symbols available without including <windows.h> */
# define DWORD unsigned int
# define CP_UTF8 65001
# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004
# define HANDLE void *
|
| ︙ | ︙ | |||
113 114 115 116 117 118 119 |
#ifndef __x86_64__
# define environ __cygwin_environ
extern char **__cygwin_environ;
#endif
# define timezone _timezone
extern int TclOSstat(const char *name, void *statBuf);
extern int TclOSlstat(const char *name, void *statBuf);
| < < < | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
#ifndef __x86_64__
# define environ __cygwin_environ
extern char **__cygwin_environ;
#endif
# define timezone _timezone
extern int TclOSstat(const char *name, void *statBuf);
extern int TclOSlstat(const char *name, void *statBuf);
#else
# define TclOSstat stat
# define TclOSlstat lstat
#endif
/*
*---------------------------------------------------------------------------
|
| ︙ | ︙ |
Changes to win/tclWinFile.c.
| ︙ | ︙ | |||
145 146 147 148 149 150 151 |
WCHAR dummyBuf[MAX_PATH * 3];
} DUMMY_REPARSE_BUFFER;
/*
* Other typedefs required by this code.
*/
| | | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
WCHAR dummyBuf[MAX_PATH * 3];
} DUMMY_REPARSE_BUFFER;
/*
* Other typedefs required by this code.
*/
static __time64_t ToCTime(FILETIME fileTime);
static void FromCTime(__time64_t posixTime, FILETIME *fileTime);
/*
* Declarations for local functions defined in this file:
*/
static int NativeAccess(const WCHAR *path, int mode);
static int NativeDev(const WCHAR *path);
|
| ︙ | ︙ | |||
2261 2262 2263 2264 2265 2266 2267 | } /* *------------------------------------------------------------------------ * * ToCTime -- * | | | | | | | 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 |
}
/*
*------------------------------------------------------------------------
*
* ToCTime --
*
* Converts a Windows FILETIME to a __time64_t in UTC.
*
* Results:
* Returns the count of seconds from the Posix epoch.
*
*------------------------------------------------------------------------
*/
static __time64_t
ToCTime(
FILETIME fileTime) /* UTC time */
{
LARGE_INTEGER convertedTime;
convertedTime.LowPart = fileTime.dwLowDateTime;
convertedTime.HighPart = (LONG) fileTime.dwHighDateTime;
return (__time64_t) ((convertedTime.QuadPart -
(Tcl_WideInt) POSIX_EPOCH_AS_FILETIME) / (Tcl_WideInt) 10000000);
}
/*
*------------------------------------------------------------------------
*
* FromCTime --
*
* Converts a __time64_t to a Windows FILETIME
*
* Results:
* Returns the count of 100-ns ticks seconds from the Windows epoch.
*
*------------------------------------------------------------------------
*/
static void
FromCTime(
__time64_t posixTime,
FILETIME *fileTime) /* UTC Time */
{
LARGE_INTEGER convertedTime;
convertedTime.QuadPart = ((LONGLONG) posixTime) * 10000000
+ POSIX_EPOCH_AS_FILETIME;
fileTime->dwLowDateTime = convertedTime.LowPart;
|
| ︙ | ︙ |
Changes to win/tclWinPort.h.
| ︙ | ︙ | |||
11 12 13 14 15 16 17 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TCLWINPORT #define _TCLWINPORT #if !defined(_WIN64) && defined(BUILD_tcl) | < | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TCLWINPORT #define _TCLWINPORT #if !defined(_WIN64) && defined(BUILD_tcl) # define __MINGW_USE_VC2005_COMPAT #endif /* * We must specify the lower version we intend to support. * * WINVER = 0x0501 means Windows XP and above */ |
| ︙ | ︙ |