Fossil SCM

For temporary filename paths on Windows, changes all backslash characters into forward slashes, so that the new enhanced-security shell escape mechanism from check-in [3b191c98] can use those temporary filenames.

drh 2017-08-23 17:18 trunk
Commit e474c177dfefd5b3945689eb1cfe0cc6d34f136d2b2fd1b9d6439dc00d63c4a6
1 file changed +5
+5
--- src/file.c
+++ src/file.c
@@ -1388,10 +1388,11 @@
13881388
0, /* GetTempPath */
13891389
0, /* TEMP */
13901390
0, /* TMP */
13911391
".",
13921392
};
1393
+ char *z;
13931394
#else
13941395
static const char *azDirs[] = {
13951396
0, /* TMPDIR */
13961397
"/var/tmp",
13971398
"/usr/tmp",
@@ -1442,10 +1443,14 @@
14421443
14431444
#if defined(_WIN32)
14441445
fossil_path_free((char *)azDirs[0]);
14451446
fossil_path_free((char *)azDirs[1]);
14461447
fossil_path_free((char *)azDirs[2]);
1448
+ /* Change all \ characters in the windows path into / so that they can
1449
+ ** be safely passed to a subcommand, such as by gdiff */
1450
+ z = blob_buffer(pBuf);
1451
+ for(i=0; z[i]; i++) if( z[i]=='\\' ) z[i] = '/';
14471452
#else
14481453
fossil_path_free((char *)azDirs[0]);
14491454
#endif
14501455
}
14511456
14521457
--- src/file.c
+++ src/file.c
@@ -1388,10 +1388,11 @@
1388 0, /* GetTempPath */
1389 0, /* TEMP */
1390 0, /* TMP */
1391 ".",
1392 };
 
1393 #else
1394 static const char *azDirs[] = {
1395 0, /* TMPDIR */
1396 "/var/tmp",
1397 "/usr/tmp",
@@ -1442,10 +1443,14 @@
1442
1443 #if defined(_WIN32)
1444 fossil_path_free((char *)azDirs[0]);
1445 fossil_path_free((char *)azDirs[1]);
1446 fossil_path_free((char *)azDirs[2]);
 
 
 
 
1447 #else
1448 fossil_path_free((char *)azDirs[0]);
1449 #endif
1450 }
1451
1452
--- src/file.c
+++ src/file.c
@@ -1388,10 +1388,11 @@
1388 0, /* GetTempPath */
1389 0, /* TEMP */
1390 0, /* TMP */
1391 ".",
1392 };
1393 char *z;
1394 #else
1395 static const char *azDirs[] = {
1396 0, /* TMPDIR */
1397 "/var/tmp",
1398 "/usr/tmp",
@@ -1442,10 +1443,14 @@
1443
1444 #if defined(_WIN32)
1445 fossil_path_free((char *)azDirs[0]);
1446 fossil_path_free((char *)azDirs[1]);
1447 fossil_path_free((char *)azDirs[2]);
1448 /* Change all \ characters in the windows path into / so that they can
1449 ** be safely passed to a subcommand, such as by gdiff */
1450 z = blob_buffer(pBuf);
1451 for(i=0; z[i]; i++) if( z[i]=='\\' ) z[i] = '/';
1452 #else
1453 fossil_path_free((char *)azDirs[0]);
1454 #endif
1455 }
1456
1457

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button