summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/lpq_parse.c32
-rw-r--r--source3/printing/printing.c9
2 files changed, 18 insertions, 23 deletions
diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c
index 13b87045cd..9d8b1cc2aa 100644
--- a/source3/printing/lpq_parse.c
+++ b/source3/printing/lpq_parse.c
@@ -149,21 +149,17 @@ static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
StrnCpy(buf->fs_file,tok[FILETOK],sizeof(buf->fs_file)-1);
if ((FILETOK + 1) != TOTALTOK) {
- int bufsize;
int i;
- bufsize = sizeof(buf->fs_file) - strlen(buf->fs_file) - 1;
-
for (i = (FILETOK + 1); i < TOTALTOK; i++) {
- safe_strcat(buf->fs_file," ",bufsize);
- safe_strcat(buf->fs_file,tok[i],bufsize - 1);
- bufsize = sizeof(buf->fs_file) - strlen(buf->fs_file) - 1;
- if (bufsize <= 0) {
- break;
- }
+ /* FIXME: Using fstrcat rather than other means is a bit
+ * inefficient; this might be a problem for enormous queues with
+ * many fields. */
+ fstrcat(buf->fs_file, " ");
+ fstrcat(buf->fs_file, tok[i]);
}
/* Ensure null termination. */
- buf->fs_file[sizeof(buf->fs_file)-1] = '\0';
+ fstrterminate(buf->fs_file);
}
#ifdef PRIOTOK
@@ -282,21 +278,17 @@ static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first)
StrnCpy(buf->fs_file,tokarr[LPRNG_FILETOK],sizeof(buf->fs_file)-1);
if ((LPRNG_FILETOK + 1) != LPRNG_TOTALTOK) {
- int bufsize;
int i;
- bufsize = sizeof(buf->fs_file) - strlen(buf->fs_file) - 1;
-
for (i = (LPRNG_FILETOK + 1); i < LPRNG_TOTALTOK; i++) {
- safe_strcat(buf->fs_file," ",bufsize);
- safe_strcat(buf->fs_file,tokarr[i],bufsize - 1);
- bufsize = sizeof(buf->fs_file) - strlen(buf->fs_file) - 1;
- if (bufsize <= 0) {
- break;
- }
+ /* FIXME: Using fstrcat rather than other means is a bit
+ * inefficient; this might be a problem for enormous queues with
+ * many fields. */
+ fstrcat(buf->fs_file, " ");
+ fstrcat(buf->fs_file, tokarr[i]);
}
/* Ensure null termination. */
- buf->fs_file[sizeof(buf->fs_file)-1] = '\0';
+ fstrterminate(buf->fs_file);
}
return(True);
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index ad5acb1505..d7ac1f49c7 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -55,8 +55,8 @@ BOOL print_backend_init(void)
if (tdb && local_pid == sys_getpid()) return True;
tdb = tdb_open_log(lock_path("printing.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
if (!tdb) {
- DEBUG(0,("print_backend_init: Failed to open printing backend database. Error = [%s]\n",
- tdb_errorstr(tdb)));
+ DEBUG(0,("print_backend_init: Failed to open printing backend database %s\n",
+ lock_path("printing.tdb") ));
return False;
}
local_pid = sys_getpid();
@@ -536,7 +536,10 @@ update the internal database from the system print queue for a queue
****************************************************************************/
static void print_queue_update(int snum)
{
- message_send_pid(background_lpq_updater_pid, MSG_PRINTER_UPDATE, &snum, sizeof(snum), False);
+ if (background_lpq_updater_pid > 0) {
+ message_send_pid(background_lpq_updater_pid, MSG_PRINTER_UPDATE,
+ &snum, sizeof(snum), False);
+ }
}
/****************************************************************************