[PATCH] cryptsetup: fix some gcc warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



fix some gcc warnings about unused or unitialized variables

Signed-off-by: Ludwig Nussel <ludwig.nussel@xxxxxxx>

Index: cryptsetup-luks-1.0.4_SVN30/lib/libdevmapper.c
===================================================================
--- cryptsetup-luks-1.0.4_SVN30.orig/lib/libdevmapper.c
+++ cryptsetup-luks-1.0.4_SVN30/lib/libdevmapper.c
@@ -258,7 +258,7 @@ static int dm_query_device(int details, 
 	options->skip = 0;
 	options->size = length;
 	if (details) {
-		char *cipher, *key_, *device, *tmp;
+		char *cipher, *key_, *device;
 		uint64_t val64;
 
 		set_error("Invalid dm table");
Index: cryptsetup-luks-1.0.4_SVN30/lib/setup.c
===================================================================
--- cryptsetup-luks-1.0.4_SVN30.orig/lib/setup.c
+++ cryptsetup-luks-1.0.4_SVN30/lib/setup.c
@@ -57,8 +57,6 @@ static int setup_enter(struct setup_back
 
 static int setup_leave(struct setup_backend *backend)
 {
-	const char *error;
-
 	if (backend)
 		backend->exit();
 
Index: cryptsetup-luks-1.0.4_SVN30/lib/utils.c
===================================================================
--- cryptsetup-luks-1.0.4_SVN30.orig/lib/utils.c
+++ cryptsetup-luks-1.0.4_SVN30/lib/utils.c
@@ -173,7 +173,7 @@ ssize_t write_blockwise(int fd, const vo
 {
 	char *padbuf; char *padbuf_base;
 	char *buf = (char *)orig_buf;
-	int r;
+	int r = 0;
 	int hangover; int solid; int bsize;
 
 	if ((bsize = sector_size(fd)) < 0)
@@ -213,7 +213,7 @@ ssize_t write_blockwise(int fd, const vo
 ssize_t read_blockwise(int fd, void *orig_buf, size_t count) {
 	char *padbuf; char *padbuf_base;
 	char *buf = (char *)orig_buf;
-	int r;
+	int r = 0;
 	int step;
 	int bsize;
 
Index: cryptsetup-luks-1.0.4_SVN30/luks/keymanage.c
===================================================================
--- cryptsetup-luks-1.0.4_SVN30.orig/luks/keymanage.c
+++ cryptsetup-luks-1.0.4_SVN30/luks/keymanage.c
@@ -417,7 +417,7 @@ static int wipe(const char *device, unsi
 int LUKS_del_key(const char *device, unsigned int keyIndex)
 {
 	struct luks_phdr hdr;
-	unsigned int i, startOffset, endOffset, stripesLen;
+	unsigned int startOffset, endOffset, stripesLen;
 	int r;
 	
 	r = LUKS_read_phdr(device, &hdr);
Index: cryptsetup-luks-1.0.4_SVN30/luks/random.c
===================================================================
--- cryptsetup-luks-1.0.4_SVN30.orig/luks/random.c
+++ cryptsetup-luks-1.0.4_SVN30/luks/random.c
@@ -13,7 +13,7 @@
 
 int getRandom(char *buf, size_t len)
 {
-	int randomfd, r = 0, index = 0;
+	int randomfd, r = 0;
 
 	//FIXME Run a FIPS test for the random device or include
 	// PRNG if urandom not avail.
Index: cryptsetup-luks-1.0.4_SVN30/src/cryptsetup.c
===================================================================
--- cryptsetup-luks-1.0.4_SVN30.orig/src/cryptsetup.c
+++ cryptsetup-luks-1.0.4_SVN30/src/cryptsetup.c
@@ -203,7 +203,8 @@ static int yesDialog(char *msg)
 	        size_t size=0;
 		fprintf(stderr,"\nWARNING!\n========\n");
 		fprintf(stderr,"%s\n\nAre you sure? (Type uppercase yes): ",msg);
-		getline(&answer,&size,stdin);
+		if(getline(&answer,&size,stdin) == -1)
+			return 0;
 		if(strcmp(answer,"YES\n") == 0)
 			r = 1;
 		free(answer);
-- 
 (o_   Ludwig Nussel
 //\   
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)

---------------------------------------------------------------------
dm-crypt mailing list - http://www.saout.de/misc/dm-crypt/
To unsubscribe, e-mail: dm-crypt-unsubscribe@xxxxxxxx
For additional commands, e-mail: dm-crypt-help@xxxxxxxx


[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux