Skip to content
Snippets Groups Projects
Commit 419b77d1 authored by rswindell's avatar rswindell
Browse files

Using new smb_lock/unlock functions to lock message base while packing

prevents any kind of access (even read-only) from other processes.
Better handling of message base filenames with '.' in them.
Automatically fixes case of supplied message base filenames.
parent 5e8d38ea
No related branches found
No related tags found
No related merge requests found
...@@ -1363,7 +1363,7 @@ time_t checktime(void) ...@@ -1363,7 +1363,7 @@ time_t checktime(void)
/***************/ /***************/
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char cmd[128]="",*p,*s; char cmd[128]="",*p;
char path[MAX_PATH+1]; char path[MAX_PATH+1];
char* to=NULL; char* to=NULL;
char* to_number=NULL; char* to_number=NULL;
...@@ -1485,13 +1485,11 @@ int main(int argc, char **argv) ...@@ -1485,13 +1485,11 @@ int main(int argc, char **argv)
SAFECOPY(cmd,argv[x]); SAFECOPY(cmd,argv[x]);
else { else {
SAFECOPY(smb.file,argv[x]); SAFECOPY(smb.file,argv[x]);
p=strrchr(smb.file,'.'); if((p=getfext(smb.file))!=NULL && stricmp(p,".shd")==0)
s=strrchr(smb.file,'/'); *p=0; /* Chop off .shd extension, if supplied on command-line */
if(s==NULL)
s=strrchr(smb.file,'\\');
if(p>s) *p=0;
sprintf(path,"%s.shd",smb.file); sprintf(path,"%s.shd",smb.file);
if(!fexist(path) && !create) { if(!fexistcase(path) && !create) {
fprintf(stderr,"\n%s doesn't exist (use -c to create)\n",path); fprintf(stderr,"\n%s doesn't exist (use -c to create)\n",path);
exit(1); exit(1);
} }
...@@ -1551,7 +1549,12 @@ int main(int argc, char **argv) ...@@ -1551,7 +1549,12 @@ int main(int argc, char **argv)
y=strlen(cmd)-1; y=strlen(cmd)-1;
break; break;
case 'P': case 'P':
if((i=smb_lock(&smb))!=0) {
fprintf(stderr,"\n\7!smb_lock returned %d: %s\n",i,smb.last_error);
return(i);
}
packmsgs(atol(cmd+y+1)); packmsgs(atol(cmd+y+1));
smb_unlock(&smb);
y=strlen(cmd)-1; y=strlen(cmd)-1;
break; break;
case 'R': case 'R':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment