Commit b16d971b authored by rswindell's avatar rswindell

Added errno to file open error messages.

parent f23316a0
......@@ -453,7 +453,7 @@ void compile(char *src)
FILE *in;
if((in=fopen(src,"rb"))==NULL) {
printf("error opening %s for read\n",src);
printf("error %d opening %s for read\n",errno,src);
bail(1); }
line=0;
......@@ -3443,7 +3443,7 @@ int main(int argc, char **argv)
sprintf(str,"%s%s",outdir,outfname); }
if((out=fopen(str,"w+b"))==NULL) {
printf("error opening %s for write\n",str);
printf("error %d opening %s for write\n",errno,str);
bail(1);
}
......
......@@ -145,7 +145,7 @@ bool sbbs_t::syslog(char* code, char *entry)
sprintf(fname,"%slogs/%2.2d%2.2d%2.2d.log",cfg.data_dir,tm->tm_mon+1,tm->tm_mday
,TM_YEAR(tm->tm_year));
if((file=nopen(fname,O_WRONLY|O_APPEND|O_CREAT))==-1) {
lprintf("!ERRROR opening/creating %s",fname);
lprintf("!ERRROR %d opening/creating %s",errno,fname);
return(false);
}
......@@ -350,7 +350,7 @@ void sbbs_t::errorlog(char *text)
logline("!!",text);
sprintf(str,"%serror.log",cfg.data_dir);
if((file=nopen(str,O_WRONLY|O_CREAT|O_APPEND))==-1) {
sprintf(tmp2,"!ERROR opening/creating %s",str);
sprintf(tmp2,"!ERROR %d opening/creating %s",errno,str);
logline("!!",tmp2);
errorlog_inside=0;
return; }
......
......@@ -476,7 +476,7 @@ int main(int argc, char **argv)
sprintf(str,"%snode.dab",ctrl_dir);
if((nodefile=sopen(str,O_RDWR|O_BINARY,SH_DENYNO))==-1) {
printf("\7\nError opening %s.\n",str);
printf("\7\nError %d opening %s.\n",errno,str);
exit(1); }
sys_nodes=filelength(nodefile)/sizeof(node_t);
......
......@@ -3519,9 +3519,10 @@ void export_echomail(char *sub_code,faddr_t addr)
printf("Fixing new-scan pointer.");
sprintf(str,"%s%s.sfp",scfg.sub[i]->data_dir,scfg.sub[i]->code);
if((file=nopen(str,O_WRONLY|O_CREAT))==-1) {
printf("\7ERROR line %d opening/creating %s",__LINE__,str);
logprintf("ERROR line %d opening/creating %s"
,__LINE__,str); }
printf("\7ERROR %d line %d opening/creating %s"
,errno,__LINE__,str);
logprintf("ERROR %d line %d opening/creating %s"
,errno,__LINE__,str); }
else {
write(file,&lastmsg,4);
close(file); } }
......@@ -3697,8 +3698,10 @@ void export_echomail(char *sub_code,faddr_t addr)
if(!addr.zone && !(misc&LEAVE_MSGPTRS) && lastmsg>ptr) {
sprintf(str,"%s%s.sfp",scfg.sub[i]->data_dir,scfg.sub[i]->code);
if((file=nopen(str,O_WRONLY|O_CREAT))==-1) {
printf("\7ERROR line %d opening/creating %s",__LINE__,str);
logprintf("ERROR line %d opening/creating %s",__LINE__,str); }
printf("\7ERROR %d line %d opening/creating %s"
,errno,__LINE__,str);
logprintf("ERROR %d line %d opening/creating %s"
,errno,__LINE__,str); }
else {
write(file,&lastmsg,4);
close(file); } } }
......@@ -4743,8 +4746,10 @@ for(i=0;i<scfg.total_subs;i++)
getlastmsg(i,&l,0);
sprintf(str,"%s%s.sfp",scfg.sub[i]->data_dir,scfg.sub[i]->code);
if((file=nopen(str,O_WRONLY|O_CREAT))==-1) {
printf("\7ERROR line %d opening/creating %s",__LINE__,str);
logprintf("ERROR line %d opening/creating %s",__LINE__,str); }
printf("\7ERROR %d line %d opening/creating %s"
,errno,__LINE__,str);
logprintf("ERROR %d line %d opening/creating %s"
,errno,__LINE__,str); }
else {
write(file,&l,sizeof(time_t));
close(file); } }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment