summaryrefslogtreecommitdiff
path: root/security/tpm-tools/files/patch-lib-tpm_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/tpm-tools/files/patch-lib-tpm_utils.c')
-rw-r--r--security/tpm-tools/files/patch-lib-tpm_utils.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/security/tpm-tools/files/patch-lib-tpm_utils.c b/security/tpm-tools/files/patch-lib-tpm_utils.c
index aa3b584a66c8..225b52c0d091 100644
--- a/security/tpm-tools/files/patch-lib-tpm_utils.c
+++ b/security/tpm-tools/files/patch-lib-tpm_utils.c
@@ -1,6 +1,6 @@
---- lib/tpm_utils.c.orig 2010-09-30 17:28:09 UTC
+--- lib/tpm_utils.c.orig 2017-02-21 01:23:56 UTC
+++ lib/tpm_utils.c
-@@ -55,6 +55,7 @@ genericOptHandler( int a_iNumArgs, char
+@@ -55,6 +55,7 @@ genericOptHandler( int a_iNumArgs, char **a_pszArgs,
CmdHelpFunction tCmdHelp = ( a_tCmdHelpFunction ) ? a_tCmdHelpFunction
: logCmdHelp;
@@ -8,39 +8,38 @@
char szShortOpts[strlen( pszGenShortOpts )
+ ( ( a_pszShortOpts == NULL ) ? 0 : strlen( a_pszShortOpts ) )
+ 1];
-@@ -64,12 +65,36 @@ genericOptHandler( int a_iNumArgs, char
+@@ -64,12 +65,35 @@ genericOptHandler( int a_iNumArgs, char **a_pszArgs,
int iOpt;
int rc;
+#else
+ int iOpt;
+ int rc;
-+
+
+ char *szShortOpts;
+ int iNumShortOpts, iNumGenLongOpts;
+ struct option *sLongOpts;
+
+ iNumShortOpts = strlen( pszGenShortOpts ) +
-+ ( ( a_pszShortOpts == NULL ) ? 0 : strlen( a_pszShortOpts ) );
++ ( ( a_pszShortOpts == NULL ) ? 0 : strlen( a_pszShortOpts ) );
+ iNumGenLongOpts = sizeof( sGenLongOpts ) / sizeof( struct option );
+
+ szShortOpts = malloc(iNumShortOpts + 1);
-+ sLongOpts = malloc((iNumGenLongOpts + a_iNumOpts + 1)
-+ * sizeof(struct option));
++ sLongOpts = malloc((iNumGenLongOpts + a_iNumOpts + 1)
++ * sizeof(struct option));
+ if( (szShortOpts == NULL) || (sLongOpts == NULL) ) {
+ perror("malloc");
+ return -1;
+ }
+#endif
-
strcpy( szShortOpts, pszGenShortOpts);
if ( a_pszShortOpts )
strcat( szShortOpts, a_pszShortOpts );
+#ifdef __GCC
- memset( sLongOpts, 0, sizeof( sLongOpts ) );
+ __memset( sLongOpts, 0, sizeof( sLongOpts ) );
+#else
-+ memset( sLongOpts, 0, (iNumGenLongOpts + a_iNumOpts + 1) * sizeof(struct option));
++ __memset( sLongOpts, 0, (iNumGenLongOpts + a_iNumOpts + 1) * sizeof(struct option));
+#endif
memcpy( sLongOpts, sGenLongOpts, sizeof( sGenLongOpts ) );
if ( a_sLongOpts ) {