Changeset 3007 for trunk/gsdl/src/recpt/statusaction.cpp
- Timestamp:
- 2002-02-27T11:50:16+13:00 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/statusaction.cpp
r2939 r3007 32 32 #include "gsdltools.h" 33 33 #include <assert.h> 34 34 #include <stdio.h> 35 #include <fcntl.h> // for open() stuff 35 36 36 37 void statusaction::output_frameset (cgiargsclass &/*args*/, displayclass &disp, … … 885 886 text_t cfgfile = filename_cat(gsdlhome, "etc", "main.cfg"); 886 887 char *cfgfilec = cfgfile.getcstr(); 887 #ifdef __WIN32__ 888 ofstream cfg_out (cfgfilec, ios::binary);889 # else890 ofstream cfg_out (cfgfilec); 888 889 int fd=open(cfgfilec, O_WRONLY | O_CREAT | O_TRUNC 890 #if defined(__WIN32__) 891 | O_BINARY 891 892 #endif 892 893 if (cfg_out) { 894 // lock the file895 int fd = GSDL_GET_FILEDESC(cfg_out); 893 ); 894 895 if (fd != -1) { 896 896 897 int lock_val = 1; 897 898 GSDL_LOCK_FILE (fd); 898 899 if (lock_val != 0) { 899 900 logout << "statusaction::change_maincfg: Error: Couldn't lock file " << cfgfilec << "\n"; 900 cfg_out.close();901 901 textout << outconvert << disp << "_status:changemaincfgfail_"; 902 902 close (fd); 903 903 } else { 904 905 904 outconvertclass text_t2ascii; 906 cfg_out << text_t2ascii << args["cfgfile"]; 905 text_t2ascii << args["cfgfile"]; 906 size_t buffersize=args["cfgfile"].size(); 907 char *buffer=new char[buffersize]; 908 size_t num_chars; 909 convertclass::status_t status; 910 text_t2ascii.convert(buffer, buffersize, num_chars, status); 911 // ignore status - assume it is "finished" as buffer is big enough 912 write(fd, buffer, num_chars); 907 913 GSDL_UNLOCK_FILE (fd); 908 cfg_out.close(); 914 delete buffer; 915 close (fd); 909 916 textout << outconvert << disp << "_status:changemaincfgsuccess_"; 910 917 } … … 913 920 textout << outconvert << disp << "_status:changemaincfgfail_"; 914 921 } 922 delete cfgfilec; 915 923 } 916 924
Note:
See TracChangeset
for help on using the changeset viewer.