From 7766c9943ebecbaa3320efcefa3afbec431f2b38 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 23 Aug 2024 21:20:50 +0000 Subject: [PATCH] Eliminate use of strcpy() in shell.c.in to squelch an unwarranted link-time warning on OpenBSD. FossilOrigin-Name: 32e9bf7f972144eacbb2580151220bc4fc1cbcc8bcf586ffd8e10762abf75c7e --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c.in | 10 +++++++++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index bb205d7a92..5736796277 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\sin\sthe\sext/fts5/extract_api_docs.tcl\sscript. -D 2024-08-23T17:40:29.728 +C Eliminate\suse\sof\sstrcpy()\sin\sshell.c.in\sto\ssquelch\san\sunwarranted\slink-time\swarning\son\sOpenBSD. +D 2024-08-23T21:20:50.763 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -765,7 +765,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 9afed5fd7b9111633bdb74a73cdc47324e28e4dc6c27113e3e9aee38fb9422ab F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 4b14337a2742f0c0beeba490e9a05507e9b4b12184b9cd12773501d08d48e3fe -F src/shell.c.in 9a45cd618ed3cd09927e04bb0ccfd929fb5efa03a7166daec4645d230b7267f3 +F src/shell.c.in 990e77ca805273edd55071c71327d202f1854e19c2e9437c039d91ff3192d7c4 F src/sqlite.h.in f07bff4225a1244efd604a0ffef81ed69f29d3dbaed7e22f906f26229ba3ca9e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2210,8 +2210,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 396f720f36a937145ac727c2750acfd26e4eda350b46d648d82a7e9985545a9f -R 9811f59e13ff374b57741662af2d5cd0 -U dan -Z b44a5154d84ee4e53cef82c304d55edf +P 9a9d0f6301faefe324261f03543023ffb6a90823349c6946abb0df2f69b31f96 +R 0473ef71b70c85fedef9e64071463927 +U stephan +Z 10e164d89e2d1a1189bcd188933ef2aa # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index be09817682..d54c88a271 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9a9d0f6301faefe324261f03543023ffb6a90823349c6946abb0df2f69b31f96 +32e9bf7f972144eacbb2580151220bc4fc1cbcc8bcf586ffd8e10762abf75c7e diff --git a/src/shell.c.in b/src/shell.c.in index a75b511903..1a1d357749 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -534,6 +534,14 @@ static char *shell_strncpy(char *dest, const char *src, size_t n){ return dest; } +/* +** strcpy() workalike to squelch an unwarranted link-time warning +** from OpenBSD. +*/ +static void shell_strcpy(char *dest, const char *src){ + while( (*(dest++) = *(src++))!=0 ){} +} + /* ** Optionally disable dynamic continuation prompt. ** Unless disabled, the continuation prompt shows open SQL lexemes if any, @@ -599,7 +607,7 @@ static char *dynamicContinuePrompt(void){ size_t ncp = strlen(continuePrompt); size_t ndp = strlen(dynPrompt.zScannerAwaits); if( ndp > ncp-3 ) return continuePrompt; - strcpy(dynPrompt.dynamicPrompt, dynPrompt.zScannerAwaits); + shell_strcpy(dynPrompt.dynamicPrompt, dynPrompt.zScannerAwaits); while( ndp<3 ) dynPrompt.dynamicPrompt[ndp++] = ' '; shell_strncpy(dynPrompt.dynamicPrompt+3, continuePrompt+3, PROMPT_LEN_MAX-4);