[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipcop-cvs
Subject:    [IPCop-cvs] ipcop/src/install+setup/install upgrade-v12-v13.c,1.2.2.1,1.2.2.2 upgrade-v130-v140.c,1.
From:       Alan Hourihane <alanh () users ! sourceforge ! net>
Date:       2004-08-30 8:28:42
Message-ID: E1C1hWt-0003wm-1M () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/ipcop/ipcop/src/install+setup/install
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15142/src/install+setup/install

Modified Files:
      Tag: IPCOP_v1_4_0
	upgrade-v12-v13.c upgrade-v130-v140.c 
Log Message:
fix some file close handling


Index: upgrade-v12-v13.c
===================================================================
RCS file: /cvsroot/ipcop/ipcop/src/install+setup/install/upgrade-v12-v13.c,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -d -r1.2.2.1 -r1.2.2.2
*** upgrade-v12-v13.c	12 Aug 2004 14:09:45 -0000	1.2.2.1
--- upgrade-v12-v13.c	30 Aug 2004 08:28:35 -0000	1.2.2.2
***************
*** 61,65 ****
          
  	if (!(portfw1 = fopen ("/harddisk/var/ipcop/portfw/config", "r"))) return 1;
! 	if (!(portfw2 = fopen ("/harddisk/var/ipcop/portfw/config.new", "w"))) return 1;
  
          while (fgets (portsrctemp, STRING_SIZE, portfw1) != NULL) {
--- 61,69 ----
          
  	if (!(portfw1 = fopen ("/harddisk/var/ipcop/portfw/config", "r"))) return 1;
! 	if (!(portfw2 = fopen ("/harddisk/var/ipcop/portfw/config.new", "w"))) 
! 	{
! 		fclose(portfw1);
! 		return 1;
! 	}
  
          while (fgets (portsrctemp, STRING_SIZE, portfw1) != NULL) {
***************
*** 73,78 ****
  		portenabled = NULL;
  		
! 		if (!(xtaccess1 = fopen ("/harddisk/var/ipcop/xtaccess/config", "r"))) return 1;
! 		if (!(xtaccess2 = fopen ("/harddisk/var/ipcop/xtaccess/config.new", "w"))) return \
1;  
  		if (isdigit (portsrctemp[0])) {
--- 77,93 ----
  		portenabled = NULL;
  		
! 		if (!(xtaccess1 = fopen ("/harddisk/var/ipcop/xtaccess/config", "r"))) 
! 		{
! 			fclose(portfw1);
! 			fclose(portfw2);
! 			return 1;
! 		}
! 		if (!(xtaccess2 = fopen ("/harddisk/var/ipcop/xtaccess/config.new", "w"))) 
! 		{
! 			fclose(portfw1);
! 			fclose(portfw2);
! 			fclose(xtaccess1);
! 			return 1;
! 		}
  
  		if (isdigit (portsrctemp[0])) {
***************
*** 193,197 ****
  			snprintf (filename, STRING_SIZE-1, "%s/%s", 
  				"/harddisk/var/ipcop/ppp", dp->d_name);
!         		if (!(settings = fopen (filename, "r+"))) return 1;
  			while (fgets (line, STRING_SIZE, settings) != NULL) {
  				if (strstr (line, "TYPE=pulsardsl") == line) {
--- 208,216 ----
  			snprintf (filename, STRING_SIZE-1, "%s/%s", 
  				"/harddisk/var/ipcop/ppp", dp->d_name);
!         		if (!(settings = fopen (filename, "r+"))) {
! 				closedir(dirp);
! 				fclose(pulsardsl);
! 				return 1;
! 			}
  			while (fgets (line, STRING_SIZE, settings) != NULL) {
  				if (strstr (line, "TYPE=pulsardsl") == line) {
***************
*** 224,241 ****
  	
  	if (!(ethernet = fopen ("/harddisk/var/ipcop/ethernet/settings", "r"))) return 1;
! 		while (fgets (line, STRING_SIZE, ethernet) != NULL) {
! 			if (strstr (line, "RED_DRIVER=pciadsl") == line) {
! 				rewind (ethernet);
! 				while (fgets (line, STRING_SIZE, ethernet) != NULL) {
! 					if (strstr (line, "RED_TYPE") == line) {
! 						strcpy (type, line + 9*sizeof(char));
! 						if (type[strlen(type) - 1] == '\n')
! 							type[strlen(type) - 1] = '\0';
! 					}
! 					if (strstr (line, "RED_ADDRESS") == line) {
! 						strcpy (ip, line + 12*sizeof(char));
! 						if (ip[strlen(ip) - 1] == '\n')
! 							type[strlen(ip) - 1] = '\0';
! 					}
  				fclose (ethernet);
  
--- 243,261 ----
  	
  	if (!(ethernet = fopen ("/harddisk/var/ipcop/ethernet/settings", "r"))) return 1;
! 
! 	while (fgets (line, STRING_SIZE, ethernet) != NULL) {
! 		if (strstr (line, "RED_DRIVER=pciadsl") == line) {
! 			rewind (ethernet);
! 			while (fgets (line, STRING_SIZE, ethernet) != NULL) {
! 				if (strstr (line, "RED_TYPE") == line) {
! 					strcpy (type, line + 9*sizeof(char));
! 					if (type[strlen(type) - 1] == '\n')
! 						type[strlen(type) - 1] = '\0';
! 				}
! 				if (strstr (line, "RED_ADDRESS") == line) {
! 					strcpy (ip, line + 12*sizeof(char));
! 					if (ip[strlen(ip) - 1] == '\n')
! 						type[strlen(ip) - 1] = '\0';
! 				}
  				fclose (ethernet);
  
***************
*** 251,255 ****
  						snprintf (filename, STRING_SIZE-1, "%s/%s", 
  							"/harddisk/var/ipcop/ppp", dp->d_name);
! 			        		if (!(settings = fopen (filename, "r+"))) return 1;
  						while (fgets (line, STRING_SIZE, settings) != NULL) {
  							if (strstr (line, "TYPE=pulsardsl") == line) {
--- 271,279 ----
  						snprintf (filename, STRING_SIZE-1, "%s/%s", 
  							"/harddisk/var/ipcop/ppp", dp->d_name);
! 			        		if (!(settings = fopen (filename, "r+"))) 
! 						{
! 							closedir(dirp);
! 							return 1;
! 						}
  						while (fgets (line, STRING_SIZE, settings) != NULL) {
  							if (strstr (line, "TYPE=pulsardsl") == line) {

Index: upgrade-v130-v140.c
===================================================================
RCS file: /cvsroot/ipcop/ipcop/src/install+setup/install/upgrade-v130-v140.c,v
retrieving revision 1.12.2.15
retrieving revision 1.12.2.16
diff -C2 -d -r1.12.2.15 -r1.12.2.16
*** upgrade-v130-v140.c	24 Aug 2004 23:00:44 -0000	1.12.2.15
--- upgrade-v130-v140.c	30 Aug 2004 08:28:35 -0000	1.12.2.16
***************
*** 96,100 ****
  
  	if (!(squidreadfile = fopen ("/harddisk" CONFIG_ROOT "/proxy/squid.conf", "r"))) \
                return 1;
! 	if (!(squidwritefile = fopen ("/harddisk" CONFIG_ROOT "/proxy/squid.conf.new", \
"w"))) return 1;  
  	if (!(readkeyvalues(kv, "/harddisk" CONFIG_ROOT "/main/settings")))
--- 96,104 ----
  
  	if (!(squidreadfile = fopen ("/harddisk" CONFIG_ROOT "/proxy/squid.conf", "r"))) \
                return 1;
! 	if (!(squidwritefile = fopen ("/harddisk" CONFIG_ROOT "/proxy/squid.conf.new", \
                "w"))) 
! 	{
! 		fclose(squidreadfile);
! 		return 1;
! 	}
  
  	if (!(readkeyvalues(kv, "/harddisk" CONFIG_ROOT "/main/settings")))
***************
*** 149,153 ****
  
  	if (!(eaglereadfile  = fopen ("/harddisk" CONFIG_ROOT "/eagle-usb/eagle-usb.conf", \
                "r"))) return 1;
! 	if (!(eaglewritefile = fopen ("/harddisk" CONFIG_ROOT \
"/eagle-usb/eagle-usb.conf.new", "w"))) return 1;  
          while (fgets (eagletemp, STRING_SIZE, eaglereadfile) != NULL) {
--- 153,161 ----
  
  	if (!(eaglereadfile  = fopen ("/harddisk" CONFIG_ROOT "/eagle-usb/eagle-usb.conf", \
                "r"))) return 1;
! 	if (!(eaglewritefile = fopen ("/harddisk" CONFIG_ROOT \
                "/eagle-usb/eagle-usb.conf.new", "w"))) 
! 	{
! 		fclose(eaglereadfile);
! 		return 1;
! 	}
  
          while (fgets (eagletemp, STRING_SIZE, eaglereadfile) != NULL) {
***************
*** 187,191 ****
  
  	if (!(dhcpreadfile = fopen ("/harddisk" CONFIG_ROOT "/dhcp/dhcpd.conf", "r"))) \
                return 1;
! 	if (!(dhcpwritefile = fopen ("/harddisk" CONFIG_ROOT "/dhcp/dhcpd.conf.new", \
"w"))) return 1;  while (fgets (dhcptemp, STRING_SIZE, dhcpreadfile) != NULL) {
  		fputs(dhcptemp, dhcpwritefile);
--- 195,203 ----
  
  	if (!(dhcpreadfile = fopen ("/harddisk" CONFIG_ROOT "/dhcp/dhcpd.conf", "r"))) \
                return 1;
! 	if (!(dhcpwritefile = fopen ("/harddisk" CONFIG_ROOT "/dhcp/dhcpd.conf.new", \
                "w"))) 
! 	{
! 		fclose(dhcpreadfile);
! 		return 1;
! 	}
  	while (fgets (dhcptemp, STRING_SIZE, dhcpreadfile) != NULL) {
  		fputs(dhcptemp, dhcpwritefile);
***************
*** 305,309 ****
  
  	if (!(vpn1 = fopen ("/harddisk" CONFIG_ROOT "/vpn/config", "r"))) return 1;
! 	if (!(vpn2 = fopen ("/harddisk" CONFIG_ROOT "/vpn/config.new", "w"))) return 1;
  
  	if (!(readkeyvalues(kv, "/harddisk" CONFIG_ROOT "/ethernet/settings")))
--- 317,325 ----
  
  	if (!(vpn1 = fopen ("/harddisk" CONFIG_ROOT "/vpn/config", "r"))) return 1;
! 	if (!(vpn2 = fopen ("/harddisk" CONFIG_ROOT "/vpn/config.new", "w"))) 
! 	{
! 		fclose(vpn1);
! 		return 1;
! 	}
  
  	if (!(readkeyvalues(kv, "/harddisk" CONFIG_ROOT "/ethernet/settings")))
***************
*** 416,430 ****
  	FILE *speedtchfirmfile;
  
! 	
! 	if ( (( speedtchfirmfile = fopen ("/harddisk" CONFIG_ROOT \
                "/alcatelusb/firmware.v4.bin", "r") )) &&
! 		 ((speedtchbootfile = fopen ("/harddisk" CONFIG_ROOT "/alcatelusb/boot.v4.bin", \
                "r"))) ) {
! 		fclose (speedtchbootfile);
  		fclose (speedtchfirmfile);
! 		system("/bin/cat /harddisk" CONFIG_ROOT "/alcatelusb/boot.v4.bin "
! 			"/harddisk" CONFIG_ROOT "/alcatelusb/firmware.v4.bin"
! 			"> /harddisk" CONFIG_ROOT "/alcatelusb/firmware.v4_b.bin");
! 		remove ("/harddisk" CONFIG_ROOT "/alcatelusb/boot.v4.bin");
! 		remove ("/harddisk" CONFIG_ROOT "/alcatelusb/firmware.v4.bin");
! 		chown ("/harddisk" CONFIG_ROOT "/alcatelusb/firmware.v4_b.bin", 99, 99);
  	}
  
--- 432,447 ----
  	FILE *speedtchfirmfile;
  
! 	if (( speedtchfirmfile = fopen ("/harddisk" CONFIG_ROOT \
                "/alcatelusb/firmware.v4.bin", "r")))
! 	{
  		fclose (speedtchfirmfile);
! 		if  ((speedtchbootfile = fopen ("/harddisk" CONFIG_ROOT \
                "/alcatelusb/boot.v4.bin", "r")))  {
! 			fclose (speedtchbootfile);
! 			system("/bin/cat /harddisk" CONFIG_ROOT "/alcatelusb/boot.v4.bin "
! 				"/harddisk" CONFIG_ROOT "/alcatelusb/firmware.v4.bin"
! 				"> /harddisk" CONFIG_ROOT "/alcatelusb/firmware.v4_b.bin");
! 			remove ("/harddisk" CONFIG_ROOT "/alcatelusb/boot.v4.bin");
! 			remove ("/harddisk" CONFIG_ROOT "/alcatelusb/firmware.v4.bin");
! 			chown ("/harddisk" CONFIG_ROOT "/alcatelusb/firmware.v4_b.bin", 99, 99);
! 		}
  	}
  
***************
*** 436,439 ****
--- 453,457 ----
  		remove ("/harddisk" CONFIG_ROOT "/alcatelusb/firmware.v123.bin");
  	}
+ 
  	remove ("/harddisk" CONFIG_ROOT "/alcatelusb/boot.v123.bin");
  



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
IPCop-cvs mailing list
IPCop-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic