Re: [PATCH] mkswap: Set UUID for swap space

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

 



On Sunday 27 January 2008, LaMont Jones wrote:
> @@ -523,6 +525,12 @@ main(int argc, char ** argv) {
>  				case 'v':
>  					version = atoi(argv[i]+2);
>  					break;
> +				case 'U':
> +					set_uuid = 1;
> +					uuid_input = argv[i]+2;
> +					if (!*uuid_input && i+1 < argc)
> +						uuid_input = argv[++i];
> +					break;
>  				default:
>  					usage();
>  			}

you should error out if HAVE_LIBUUID is not defined and someone tries to 
use -U since it obviously isnt going to work

>  #ifdef HAVE_LIBUUID
> -	uuid_generate(uuid_dat);
> -	uuid = uuid_dat;
> +	if(!set_uuid)
> +	{
> + 	  uuid_generate(uuid_dat);
> +    	  uuid = uuid_dat;
> +	} else {
> +	  uuid_parse(uuid_input, uuid_dat);
> +	  uuid = uuid_dat;
> +	}

there's no point in the braces since the second statement is the same ... just 
move the uuid assignment outside of the if block and drop the braces 
(especially since the first brace would have needed to be cuddled up anyways)
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux