[Libguestfs] [PATCH 3/3] Remove problematic swprintf_s

Matthew Booth mbooth at redhat.com
Wed Aug 21 16:16:11 UTC 2013


Using swprintf_s results in a link error when executed on Windows 2003. Given
that its use isn't important here and an alternative is already available, this
change simply removes it.
---
 RHSrvAny/RHSrvAny.c | 7 -------
 configure.ac        | 2 +-
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/RHSrvAny/RHSrvAny.c b/RHSrvAny/RHSrvAny.c
index e4b4a46..afbbf34 100644
--- a/RHSrvAny/RHSrvAny.c
+++ b/RHSrvAny/RHSrvAny.c
@@ -22,7 +22,6 @@
 #else
 /* Assume we're not using autoconf, eg. for Visual C++. */
 #define HAVE_STRSAFE 1
-#define HAVE_SWPRINTF_S 1
 #define HAVE_STRINGCCHPRINTF 1
 #endif /* HAVE_CONFIG_H */
 
@@ -292,15 +291,9 @@ SvcInit (
     ZeroMemory( &pi, sizeof(pi) );
     nSize=1024;
 
-#ifdef HAVE_SWPRINTF_S
-    swprintf_s (
-        szRegistryPath,
-        nSize,
-#else
     snwprintf (
         szRegistryPath,
         sizeof szRegistryPath,
-#endif
         L"SYSTEM\\CurrentControlSet\\services\\%s\\Parameters",
         svcname
     );
diff --git a/configure.ac b/configure.ac
index cc2a584..e58941d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,7 +39,7 @@ dnl Check for headers which are not present in some versions of MinGW.
 AC_CHECK_HEADERS([strsafe.h])
 
 dnl Check for functions which are not present in some versions of MinGW.
-AC_CHECK_FUNCS([swprintf_s StringCchPrintf])
+AC_CHECK_FUNCS([StringCchPrintf])
 
 dnl Produce output files.
 AC_CONFIG_HEADERS([config.h])
-- 
1.8.3.1




More information about the Libguestfs mailing list