faubackup2/src/common system_calls.cpp,1.3,1.4 system_calls.hpp,1.2,1.3

Erik Merkel <[email protected]> Thu, 09 Jun 2005 15:39:56 +0000
Newsgroups gmane.comp.sysutils.backup.faubackup.cvs
Message-ID <[email protected]>
Update of /cvsroot/faubackup/faubackup2/src/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6636/src/common

Modified Files:
	system_calls.cpp system_calls.hpp 
Log Message:
removed hardcoded protocol version on multiple positions


Index: system_calls.cpp
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/common/system_calls.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** system_calls.cpp	8 Jun 2005 19:29:04 -0000	1.3
--- system_calls.cpp	9 Jun 2005 15:39:53 -0000	1.4
***************
*** 235,239 ****
  		if( flags & SET_LINK_OWNER ) {
  			ret = 0; /* simply ignore if it's not supported */
! 		} else {
  			ret = chown(path.c_str(), st->st_uid, st->st_gid);
  		}
--- 235,240 ----
  		if( flags & SET_LINK_OWNER ) {
  			ret = 0; /* simply ignore if it's not supported */
! 		}
! 		else {
  			ret = chown(path.c_str(), st->st_uid, st->st_gid);
  		}
***************
*** 247,251 ****
  			//cannot_set_owner();
  			mode &= ~06000;
! 		} else
  			if( ret < 0 ) {
  				fprintf( stderr, "error: lchown(%s, %d, %d): %s\n",
--- 248,253 ----
  			//cannot_set_owner();
  			mode &= ~06000;
! 		}
! 		else
  			if( ret < 0 ) {
  				fprintf( stderr, "error: lchown(%s, %d, %d): %s\n",
***************
*** 330,334 ****
  
  	if (fd_pair(pipe1) < 0 ||
! 	    fd_pair(pipe2) < 0)
  		perror("pipe-Fehler");
  
--- 332,336 ----
  
  	if (fd_pair(pipe1) < 0 ||
! 	        fd_pair(pipe2) < 0)
  		perror("pipe-Fehler");
  
***************
*** 345,352 ****
  			f_in = pipe2[0];
  
! 			char bla = 0;
! 			if(read(f_in, &bla, 1) < 1)
  				output.critical("error connecting!", errno);
! 			if (bla !=42)
  				output.critical("Protocol error - wrong Handshake", 0);
  			output.information("Protocol Handshake successful", DEBUG_OUTPUT);
--- 347,354 ----
  			f_in = pipe2[0];
  
! 			char remote_protocol_ver = 0;
! 			if(read(f_in, &remote_protocol_ver, 1) < 1)
  				output.critical("error connecting!", errno);
! 			if (remote_protocol_ver != PROTOCOL_VERSION)
  				output.critical("Protocol error - wrong Handshake", 0);
  			output.information("Protocol Handshake successful", DEBUG_OUTPUT);
***************
*** 381,385 ****
  
  	if (fd_pair(to_child_pipe) < 0 ||
! 	    fd_pair(from_child_pipe) < 0) {
  		output.critical("unable to create pipe", errno);
  	}
--- 383,387 ----
  
  	if (fd_pair(to_child_pipe) < 0 ||
! 	        fd_pair(from_child_pipe) < 0) {
  		output.critical("unable to create pipe", errno);
  	}
***************
*** 392,398 ****
  	if (pid == 0) {
  		if (dup2(to_child_pipe[0], STDIN_FILENO) < 0 ||
! 		    close(to_child_pipe[1]) < 0 ||
! 		    close(from_child_pipe[0]) < 0 ||
! 		    dup2(from_child_pipe[1], STDOUT_FILENO) < 0) {
  			output.critical("Failed to dup/close", errno);
  		}
--- 394,400 ----
  	if (pid == 0) {
  		if (dup2(to_child_pipe[0], STDIN_FILENO) < 0 ||
! 		        close(to_child_pipe[1]) < 0 ||
! 		        close(from_child_pipe[0]) < 0 ||
! 		        dup2(from_child_pipe[1], STDOUT_FILENO) < 0) {
  			output.critical("Failed to dup/close", errno);
  		}
***************
*** 406,410 ****
  
  	if (close(from_child_pipe[1]) < 0 ||
! 	    close(to_child_pipe[0]) < 0) {
  		output.critical("Failed to close", errno);
  	}
--- 408,412 ----
  
  	if (close(from_child_pipe[1]) < 0 ||
! 	        close(to_child_pipe[0]) < 0) {
  		output.critical("Failed to close", errno);
  	}
***************
*** 505,509 ****
  
  		if( strcmp(de->d_name, ".") == 0
! 		    || strcmp(de->d_name, "..") == 0 )
  		{
  			continue;
--- 507,511 ----
  
  		if( strcmp(de->d_name, ".") == 0
! 		        || strcmp(de->d_name, "..") == 0 )
  		{
  			continue;
***************
*** 606,610 ****
  		string entry;
  		if( strcmp(de->d_name, ".") == 0
! 		    || strcmp(de->d_name, "..") == 0 )
  			continue;
  
--- 608,612 ----
  		string entry;
  		if( strcmp(de->d_name, ".") == 0
! 		        || strcmp(de->d_name, "..") == 0 )
  			continue;
  
***************
*** 754,758 ****
  		close(fd_source);
  		close(fd_dest);
! 	} else {
  		if (lseek(fd_dest, st.st_size-1, SEEK_SET) == -1)
  			output.critical("lseek error " + destination, errno);
--- 756,761 ----
  		close(fd_source);
  		close(fd_dest);
! 	}
! 	else {
  		if (lseek(fd_dest, st.st_size-1, SEEK_SET) == -1)
  			output.critical("lseek error " + destination, errno);
***************
*** 770,774 ****
  
  		if (munmap(source_mem, st.st_size) == -1 ||
! 		    munmap(dest_mem, st.st_size) == -1)
  			output.critical("munmap error", errno);
  
--- 773,777 ----
  
  		if (munmap(source_mem, st.st_size) == -1 ||
! 		        munmap(dest_mem, st.st_size) == -1)
  			output.critical("munmap error", errno);
  
***************
*** 831,835 ****
  	while ((entry = readdir(directory)) != NULL) {
  		if((strcmp(entry->d_name, "..") == 0) ||
! 		    (strcmp(entry->d_name,".") == 0)   )
  			continue;
  		string filename = dirName + entry->d_name;
--- 834,838 ----
  	while ((entry = readdir(directory)) != NULL) {
  		if((strcmp(entry->d_name, "..") == 0) ||
! 		        (strcmp(entry->d_name,".") == 0)   )
  			continue;
  		string filename = dirName + entry->d_name;
***************
*** 837,841 ****
  		/* is directory */
  		if ((st.st_mode & S_IFMT)
! 		    == S_IFDIR)
  			removeDir(filename);
  		else
--- 840,844 ----
  		/* is directory */
  		if ((st.st_mode & S_IFMT)
! 		        == S_IFDIR)
  			removeDir(filename);
  		else

Index: system_calls.hpp
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/common/system_calls.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** system_calls.hpp	8 Jun 2005 19:29:04 -0000	1.2
--- system_calls.hpp	9 Jun 2005 15:39:54 -0000	1.3
***************
*** 16,20 ****
  
  
! 
  
  namespace faubackup
--- 16,20 ----
  
  
! #define PROTOCOL_VERSION 42
  
  namespace faubackup



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20