Hylafax Mailing List Archives
|
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
Re: Can not open document file
I have also experience this "cannot open document" problem. Here is my
patch to fix it. Note that this works on a Linux 2.0.28 box. It has not
been tested on anything else.
=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** faxd/faxQCleanApp.c++-orig Wed Mar 5 12:23:40 1997
--- faxd/faxQCleanApp.c++ Wed Mar 5 12:25:19 1997
***************
*** 1,4 ****
--- 1,6 ----
+ #include <string>
+
/* $Id: faxQCleanApp.c++,v 1.8 1996/08/21 21:53:43 sam Rel $ */
/*
* Copyright (c) 1990-1996 Sam Leffler
* Copyright (c) 1991-1996 Silicon Graphics, Inc.
***************
*** 284,292 ****
(const char*) file);
continue;
}
/*
! * Document files should only have on link to them except
* during the job preparation stage (i.e. when hfaxd has
* original in the tmp directory and a link in the docq
* directory). Therefore if file has multiple links then
* it's not a candidate for removal. Note that this assumes
--- 286,294 ----
(const char*) file);
continue;
}
/*
! * Document files should only have one link to them except
* during the job preparation stage (i.e. when hfaxd has
* original in the tmp directory and a link in the docq
* directory). Therefore if file has multiple links then
* it's not a candidate for removal. Note that this assumes
***************
*** 333,340 ****
--- 335,345 ----
printf("%s: file looks to be referenced by job\n",
(const char*) file);
continue; // skip, in use
}
+ else if (trace)
+ printf("%s: file has no matching %s\n",
+ (const char*) file, (const char*)qfile);
} else if (strcmp(&file[l], "cover") == 0) {
/*
* Cover page document has a jobid suffix
* at the front; look to see if the job still
***************
*** 347,354 ****
--- 352,394 ----
printf("%s: file looks to be referenced by job\n",
(const char*) file);
continue; // skip, in use
}
+ }
+ else if(((l = file.nextR(file.length(), ';')) != 0) &&
+ l < file.length()) {
+ // Check to make sure we don't delete a file with a ';'
+ // suffix, when the PS.jobid version of the file still
+ // exists.
+ string base(&file[5], (l -= 6));
+ bool got_match = false;
+ DIR *dir1 = Sys::opendir(docDir);
+
+ if(dir1 == 0) {
+ printf("%s: Could not scan directory for base file.\n",
+ (const char *) docDir);
+ continue;
+ }
+ for(dirent *dp1 = readdir(dir1); dp1; dp1 = readdir(dir1)) {
+ if(trace)
+ printf(" Compare \"%s\" to \"%s\". (l=%d, dp1->d_name[l]=%c\n",
+ dp1->d_name, base.c_str(), l, dp1->d_name[l]);
+ if(strlen(dp1->d_name) > l && dp1->d_name[l] == '.' &&
+ base == string(dp1->d_name, l)) {
+ // Found match
+ if(trace)
+ printf("%s: found match to base '%s', skipping.\n",
+ (const char *)file, dp1->d_name);
+ got_match = true;
+ break;
+ }
+ }
+ closedir(dir1);
+ if(got_match)
+ continue;
+ if(trace)
+ printf("%s: did not find base '%s' match.\n",
+ (const char *) file, base.c_str());
}
}
if (nowork || Sys::unlink(file) >= 0) {
if (verbose)
=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
This seems to take care of the problem for me. Your milage may vary.
John
--
| |
+--+ == | John Patrick Poet Blue Sky Tours
| | | System Admin/programmer 10832 Prospect Ave., N.E.
| +---+ john@BlueSkyTours.COM Albuquerque, N.M. 87112
| | Ph. 505 293 9462 Fx. 505 293 6902