From bc7687f5df3adc067882e19664e9d39d3879341f Mon Sep 17 00:00:00 2001 From: IgnorantGuru Date: Sun, 3 Mar 2013 10:07:43 -0700 Subject: [PATCH] clear -Werror=format-security warnings --- src/device-info.c | 10 +++++----- src/udevil.c | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/device-info.c b/src/device-info.c index aa32324..0fe3608 100644 --- a/src/device-info.c +++ b/src/device-info.c @@ -1129,16 +1129,16 @@ void info_partition( device_t *device ) size = sysfs_get_uint64 (device->native_path, "size"); alignment_offset = sysfs_get_uint64 (device->native_path, "alignment_offset"); - device->partition_size = g_strdup_printf( "%d", size * 512 ); - device->partition_alignment_offset = g_strdup_printf( "%d", alignment_offset ); + device->partition_size = g_strdup_printf( "%lu", size * 512 ); + device->partition_alignment_offset = g_strdup_printf( "%lu", alignment_offset ); offset = sysfs_get_uint64 (device->native_path, "start") * device->device_block_size; - device->partition_offset = g_strdup_printf( "%d", offset ); + device->partition_offset = g_strdup_printf( "%lu", offset ); s = device->native_path; for (n = strlen (s) - 1; n >= 0 && g_ascii_isdigit (s[n]); n--) ; - device->partition_number = g_strdup_printf( "%d", strtol (s + n + 1, NULL, 0) ); + device->partition_number = g_strdup_printf( "%ld", strtol (s + n + 1, NULL, 0) ); /* s = g_strdup (device->priv->native_path); for (n = strlen (s) - 1; n >= 0 && s[n] != '/'; n--) @@ -1384,7 +1384,7 @@ char* device_show_info( device_t *device ) line[i++] = g_strdup_printf(" partition:\n"); line[i++] = g_strdup_printf(" scheme: %s\n", device->partition_scheme ? device->partition_scheme : "" ); - line[i++] = g_strdup_printf(" number: %d\n", device->partition_number ? + line[i++] = g_strdup_printf(" number: %s\n", device->partition_number ? device->partition_number : "" ); line[i++] = g_strdup_printf(" type: %s\n", device->partition_type ? device->partition_type : "" ); diff --git a/src/udevil.c b/src/udevil.c index 4c48769..5c026ea 100644 --- a/src/udevil.c +++ b/src/udevil.c @@ -685,9 +685,9 @@ char *replace_string( const char* orig, const char* str, const char* replace, if ( !replace ) { if ( quote ) - rep = g_strdup_printf( "''" ); + rep = g_strdup( "''" ); else - rep = g_strdup_printf( "" ); + rep = g_strdup( "" ); } else if ( quote ) rep = g_strdup_printf( "'%s'", replace ); @@ -1143,7 +1143,7 @@ static void dump_log() } if ( file ) { - if ( fprintf( file, logmem ) < 1 ) + if ( fprintf( file, logmem, NULL ) < 1 ) fail = TRUE; if ( fclose( file ) != 0 ) fail = TRUE; @@ -2065,9 +2065,9 @@ static int try_umount( const char* device_file, gboolean force, gboolean lazy ) // success - show output wlog( _("udevil: success running umount as current user\n"), NULL, 1 ); if ( sstderr ) - fprintf( stderr, sstderr ); + fprintf( stderr, sstderr, NULL ); if ( sstdout ) - fprintf( stdout, sstdout ); + fprintf( stdout, sstdout, NULL ); g_free( sstdout ); g_free( sstderr ); return 0; @@ -4056,7 +4056,7 @@ _get_type: { if ( !valid_mount_path( point, &str ) ) { - printf( str ); + printf( str, NULL ); g_free( str ); ret = 2; goto _finish;