From 75ca69243019ae1f422bd0e7c336e9f92a0d941c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 18 Dec 2007 18:01:34 -0800 Subject: Remove another static fstring. Jeremy. (This used to be commit f9182bbe628cb5f5395a08b2e09d4a282a99d7dc) --- source3/printing/lpq_parse.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source3/printing/lpq_parse.c') diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c index 56e228f219..6dcddb6f1b 100644 --- a/source3/printing/lpq_parse.c +++ b/source3/printing/lpq_parse.c @@ -444,7 +444,7 @@ static bool parse_lpq_hpux(char *line, print_queue_struct *buf, bool first) { /* must read two lines to process, therefore keep some values static */ static bool header_line_ok=False, base_prio_reset=False; - static fstring jobuser; + static char *jobuser; static int jobid; static int jobprio; static time_t jobtime; @@ -511,7 +511,11 @@ static bool parse_lpq_hpux(char *line, print_queue_struct *buf, bool first) buf->job = jobid; buf->status = jobstat; buf->priority = jobprio; - fstrcpy(buf->fs_user,jobuser); + if (jobuser) { + fstrcpy(buf->fs_user,jobuser); + } else { + buf->fs_user[0] = '\0'; + } TALLOC_FREE(frame); return True; @@ -548,7 +552,8 @@ static bool parse_lpq_hpux(char *line, print_queue_struct *buf, bool first) return False; } jobid = atoi(tok[1]); - fstrcpy(jobuser,tok[2]); + SAFE_FREE(jobuser); + jobuser = SMB_STRDUP(tok[2]); jobprio = atoi(tok[4]); /* process time */ -- cgit From 587cf54c61c9f1f7bcae431a82035fd942716c32 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 23 Jan 2008 11:04:10 +0100 Subject: strtok -> strtok_r (This used to be commit fd34ce437057bb34cdc37f4b066e424000d36789) --- source3/printing/lpq_parse.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/printing/lpq_parse.c') diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c index 6dcddb6f1b..afa3b4850a 100644 --- a/source3/printing/lpq_parse.c +++ b/source3/printing/lpq_parse.c @@ -127,6 +127,7 @@ static bool parse_lpq_bsd(char *line,print_queue_struct *buf,bool first) int count = 0; TALLOC_CTX *ctx = talloc_tos(); char *line2 = NULL; + char *saveptr; line2 = talloc_strdup(ctx, line); if (!line2) { @@ -144,10 +145,11 @@ static bool parse_lpq_bsd(char *line,print_queue_struct *buf,bool first) #endif /* OSF1 */ /* FIXME: Use next_token_talloc rather than strtok! */ - tok[0] = strtok(line2," \t"); + tok[0] = strtok_r(line2," \t", &saveptr); count++; - while ((count < MAXTOK) && ((tok[count] = strtok(NULL," \t")) != NULL)) { + while ((count < MAXTOK) + && ((tok[count] = strtok_r(NULL, " \t", &saveptr)) != NULL)) { count++; } -- cgit