cvs commit: ALFS/nALFS/src logging.c nalfs.c

neven at linuxfromscratch.org neven at linuxfromscratch.org
Sat Nov 1 10:25:39 PST 2003


neven       03/11/01 11:25:39

  Modified:    nALFS/src logging.c nalfs.c
  Log:
  Smaller code improvements.
  
  Revision  Changes    Path
  1.13      +3 -1      ALFS/nALFS/src/logging.c
  
  Index: logging.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/logging.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- logging.c	30 Oct 2003 04:56:52 -0000	1.12
  +++ logging.c	1 Nov 2003 18:25:39 -0000	1.13
  @@ -569,7 +569,9 @@
   
   	package_string = alloc_package_string(current_package);
   
  -	Nprint("Sending the package log to the frontend... ");
  +	if (opt_be_verbose) {
  +		Nprint("Sending the package log to the frontend... ");
  +	}
   
   	comm_send_ctrl_msg(BACKEND_CTRL_SOCK,
   		CTRL_SENDING_LOG_FILE, "%s", package_string);
  
  
  
  1.30      +24 -32    ALFS/nALFS/src/nalfs.c
  
  Index: nalfs.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/nalfs.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- nalfs.c	1 Nov 2003 17:46:35 -0000	1.29
  +++ nalfs.c	1 Nov 2003 18:25:39 -0000	1.30
  @@ -575,18 +575,31 @@
   	}
   }
   
  -static INLINE int receive_changed_files(logs_t *logs)
  +/*
  + * Reads the list of installed files from the backend, stores
  + * it in the file, and updates the package's log with its name.
  + */
  +static INLINE void receive_changed_files(logs_t *logs)
   {
  -	char *filename = logs_create_flog(logs);
  +	ctrl_msg_s *message;
   
  -	if (comm_read_to_file(FRONTEND_CTRL_SOCK, filename) == 0) {
  -		if (filename) {
  -			Nprint("Installed files stored in \"%s\".", filename);
  -			return 0;
  +	if ((message = comm_read_ctrl_message(FRONTEND_CTRL_SOCK))) {
  +		ctrl_msg_type_e type = comm_msg_type(message);
  +
  +		if (type == CTRL_SENDING_FILES_FILE) {
  +			char *f = logs_create_flog(logs);
  +
  +			if (comm_read_to_file(FRONTEND_CTRL_SOCK, f) == 0) {
  +				if (f) {
  +					logs_update_with_flog(logs);
  +					Nprint("List of installed files stored in:");
  +					Nprint("%s", f);
  +				}
  +			}
   		}
  -	}
   
  -	return -1;
  +		comm_free_message(message);
  +	}
   }
   
   static INLINE void receive_log_file(const char *package_str)
  @@ -611,36 +624,15 @@
   	xfree(pdir);
   	xfree(ptr);
   
  -	/*
  -	 * Read the list of installed files (if any) from the backend,
  -	 * store it in the file, and update the package log with its name.
  -	 *
  -	 * TODO: Put it in a separate function.
  -	 *
  -	 * TODO: There's no point relying on log file's content,
  -	 *       this should be in handle_ctrl_msg(), waiting for
  -	 *       CTRL_SENDING_FILES_FILE.
  -	 */
   	if (logs_has_flog(logs)) {
  -		ctrl_msg_s *message;
  -
  -		if ((message = comm_read_ctrl_message(FRONTEND_CTRL_SOCK))) {
  -			ctrl_msg_type_e type = comm_msg_type(message);
  -
  -			if (type == CTRL_SENDING_FILES_FILE) {
  -				if (receive_changed_files(logs) == 0) {
  -					logs_update_with_flog(logs);
  -				}
  -			}
  -		}
  -
  -		comm_free_message(message);
  +		receive_changed_files(logs);
   	}
   
   	s = logs_get_plog_filename(logs, 0);
   
   	if (logs_save(logs) == 0) {
  -		Nprint("Log file stored in \"%s\".", s);
  +		Nprint("Log file stored in:");
  +		Nprint("%s", s);
   	} else {
   		Nprint_err("Unable to save log file to %s.", s);
   	}
  
  
  



More information about the alfs-log mailing list