cvs commit: ALFS/nALFS/src/handlers digest.c unpack.c

kpfleming at linuxfromscratch.org kpfleming at linuxfromscratch.org
Tue Feb 24 21:03:43 PST 2004


kpfleming    04/02/24 22:03:43

  Modified:    nALFS/src/handlers digest.c unpack.c
  Log:
  fix bugs in digest handling
  
  Revision  Changes    Path
  1.2       +6 -6      ALFS/nALFS/src/handlers/digest.c
  
  Index: digest.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/handlers/digest.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- digest.c	25 Feb 2004 04:33:19 -0000	1.1
  +++ digest.c	25 Feb 2004 05:03:43 -0000	1.2
  @@ -70,7 +70,7 @@
   	struct digest_data *data = (struct digest_data *) element->handler_data;
   
   	xfree(data->content);
  -	xfree(data->version);
  +	xfree(data->type);
   	xfree(data);
   }
   
  @@ -120,19 +120,18 @@
   			 const handler_data_e data_requested)
   {
   	struct digest_data *data = (struct digest_data *) element->handler_data;
  -	char *result;
   
   	switch (data_requested) {
   	case HDATA_COMMAND:
   		/* We're cheating here, and returning the digest as an HDATA_COMMNAND */
  -		result = xstrdup(data->content);
  +		return xstrdup(data->content);
   		break;
   	case HDATA_VERSION:
   		/* We're cheating here, and returning the digest type as an HDATA_VERSION */
   		if (data->type) {
  -			result = xstrdup(data->type);
  +			return xstrdup(data->type);
   		} else {
  -			result = xstrdup("md5");
  +			return xstrdup("md5");
   		}
   		break;
   	default:
  @@ -142,8 +141,9 @@
   	return NULL;
   }
   
  -static int digest_main(const element_s * const el)
  +static int digest_main(const element_s * const element)
   {
  +	(void) element;
   	/* should never be called */
   	return 1;
   }
  
  
  
  1.27      +8 -10     ALFS/nALFS/src/handlers/unpack.c
  
  Index: unpack.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/handlers/unpack.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- unpack.c	25 Feb 2004 04:33:19 -0000	1.26
  +++ unpack.c	25 Feb 2004 05:03:43 -0000	1.27
  @@ -284,10 +284,9 @@
   #if HANDLER_SYNTAX_3_0 || HANDLER_SYNTAX_3_1
   
   static const struct handler_parameter unpack_parameters_v3[] = {
  -	{ .name = "archive" },
  -	{ .name = "destination" },
  -	{ .name = "digest" },
  -	{ .name = "reference" },
  +	{ .name = "archive", .private = UNPACK_ARCHIVE },
  +	{ .name = "destination", .private = UNPACK_DESTINATION },
  +	{ .name = "reference", .private = UNPACK_REFERENCE },
   	{ .name = NULL }
   };
   
  @@ -331,7 +330,7 @@
   			Nprint_h_err("Checking for %s failed:", data->archive);
   			Nprint_h_err("    %s", strerror(errno));
   		}
  -	} else if (data->digest && verify_digest(digest_type, digest, data->archive)) {
  +	} else if (digest && verify_digest(digest_type, digest, data->archive)) {
   		Nprint_h_err("Wrong %s digest of archive: %s", digest_type, data->archive);
   	} else {
   		status = 0;
  @@ -356,14 +355,13 @@
   #if HANDLER_SYNTAX_3_2
   
   static const struct handler_parameter unpack_parameters_v3_2[] = {
  -	{ .name = "archive" },
  -	{ .name = "digest" },
  -	{ .name = "reference" },
  +	{ .name = "archive", .private = UNPACK_ARCHIVE },
  +	{ .name = "reference", .private = UNPACK_REFERENCE },
   	{ .name = NULL }
   };
   
   static const struct handler_attribute unpack_attributes_v3_2[] = {
  -	{ .name = "base" },
  +	{ .name = "base", .private = UNPACK_BASE },
   	{ .name = NULL }
   };
   
  @@ -430,7 +428,7 @@
   			Nprint_h_err("Checking for %s failed:", data->archive);
   			Nprint_h_err("    %s", strerror(errno));
   		}
  -	} else if (data->digest && verify_digest(digest_type, digest, data->archive)) {
  +	} else if (digest && verify_digest(digest_type, digest, data->archive)) {
   		Nprint_h_err("Wrong %s digest of archive: %s", digest_type, data->archive);
   	} else {
   		status = 0;
  
  
  



More information about the alfs-log mailing list