Fossil SCM

Update auto.def and relevant source files to account for the definition of getpass() in Termux' unistd.h.

danield 2021-01-06 15:58 trunk
Commit f2aa77cc3fd3bd42ceb2f7fdfd461f6a68cbc7b665a1a0b4317cc66acc1054d6
3 files changed +8 +1 -1 +1 -1
+8
--- auto.def
+++ auto.def
@@ -570,10 +570,18 @@
570570
cc-check-functions utime
571571
cc-check-functions usleep
572572
cc-check-functions strchrnul
573573
cc-check-functions pledge
574574
cc-check-functions backtrace
575
+
576
+# Termux on Android adds "getpass(char *)" to unistd.h, so check this so we
577
+# guard against including it again; use cctest as cc-check-functions and
578
+# cctest_function check for "getpass()" with no args and fail
579
+if {[cctest -link 1 -includes {unistd.h} -code "getpass(0);"]} {
580
+ define FOSSIL_HAVE_GETPASS 1
581
+ msg-result "Found getpass() with unistd.h"
582
+}
575583
576584
# Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
577585
if {![cc-check-functions getloadavg]} {
578586
define FOSSIL_OMIT_LOAD_AVERAGE 1
579587
msg-result "Load average support unavailable"
580588
--- auto.def
+++ auto.def
@@ -570,10 +570,18 @@
570 cc-check-functions utime
571 cc-check-functions usleep
572 cc-check-functions strchrnul
573 cc-check-functions pledge
574 cc-check-functions backtrace
 
 
 
 
 
 
 
 
575
576 # Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
577 if {![cc-check-functions getloadavg]} {
578 define FOSSIL_OMIT_LOAD_AVERAGE 1
579 msg-result "Load average support unavailable"
580
--- auto.def
+++ auto.def
@@ -570,10 +570,18 @@
570 cc-check-functions utime
571 cc-check-functions usleep
572 cc-check-functions strchrnul
573 cc-check-functions pledge
574 cc-check-functions backtrace
575
576 # Termux on Android adds "getpass(char *)" to unistd.h, so check this so we
577 # guard against including it again; use cctest as cc-check-functions and
578 # cctest_function check for "getpass()" with no args and fail
579 if {[cctest -link 1 -includes {unistd.h} -code "getpass(0);"]} {
580 define FOSSIL_HAVE_GETPASS 1
581 msg-result "Found getpass() with unistd.h"
582 }
583
584 # Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
585 if {![cc-check-functions getloadavg]} {
586 define FOSSIL_OMIT_LOAD_AVERAGE 1
587 msg-result "Load average support unavailable"
588
+1 -1
--- src/main.c
+++ src/main.c
@@ -345,11 +345,11 @@
345345
/*
346346
** Zero, unlock, and free the saved database encryption key now.
347347
*/
348348
db_unsave_encryption_key();
349349
#endif
350
-#if defined(_WIN32) || defined(__BIONIC__)
350
+#if defined(_WIN32) || defined(__BIONIC__) && !defined(FOSSIL_HAVE_GETPASS)
351351
/*
352352
** Free the secure getpass() buffer now.
353353
*/
354354
freepass();
355355
#endif
356356
--- src/main.c
+++ src/main.c
@@ -345,11 +345,11 @@
345 /*
346 ** Zero, unlock, and free the saved database encryption key now.
347 */
348 db_unsave_encryption_key();
349 #endif
350 #if defined(_WIN32) || defined(__BIONIC__)
351 /*
352 ** Free the secure getpass() buffer now.
353 */
354 freepass();
355 #endif
356
--- src/main.c
+++ src/main.c
@@ -345,11 +345,11 @@
345 /*
346 ** Zero, unlock, and free the saved database encryption key now.
347 */
348 db_unsave_encryption_key();
349 #endif
350 #if defined(_WIN32) || defined(__BIONIC__) && !defined(FOSSIL_HAVE_GETPASS)
351 /*
352 ** Free the secure getpass() buffer now.
353 */
354 freepass();
355 #endif
356
+1 -1
--- src/user.c
+++ src/user.c
@@ -38,11 +38,11 @@
3838
if( z[i]>0 && z[i]<' ' ) z[i] = ' ';
3939
}
4040
blob_append(pBlob, z, -1);
4141
}
4242
43
-#if defined(_WIN32) || defined(__BIONIC__)
43
+#if defined(_WIN32) || defined(__BIONIC__) && !defined(FOSSIL_HAVE_GETPASS)
4444
#ifdef _WIN32
4545
#include <conio.h>
4646
#endif
4747
4848
/*
4949
--- src/user.c
+++ src/user.c
@@ -38,11 +38,11 @@
38 if( z[i]>0 && z[i]<' ' ) z[i] = ' ';
39 }
40 blob_append(pBlob, z, -1);
41 }
42
43 #if defined(_WIN32) || defined(__BIONIC__)
44 #ifdef _WIN32
45 #include <conio.h>
46 #endif
47
48 /*
49
--- src/user.c
+++ src/user.c
@@ -38,11 +38,11 @@
38 if( z[i]>0 && z[i]<' ' ) z[i] = ' ';
39 }
40 blob_append(pBlob, z, -1);
41 }
42
43 #if defined(_WIN32) || defined(__BIONIC__) && !defined(FOSSIL_HAVE_GETPASS)
44 #ifdef _WIN32
45 #include <conio.h>
46 #endif
47
48 /*
49

Keyboard Shortcuts

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