summaryrefslogtreecommitdiff
path: root/source3/printing/lpq_parse.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2008-02-01 14:24:31 -0500
committerSimo Sorce <idra@samba.org>2008-02-01 14:24:31 -0500
commit2fffc9a1b1fe2a1490e867bb38462e50c282d2b3 (patch)
tree428e09c9b35138db8b7ca7161c659a71aa129d29 /source3/printing/lpq_parse.c
parent93a3c5b3f9927973b4ad1496f593ea147052d1e1 (diff)
parentb708005a7106db26d7df689b887b419c9f2ea41c (diff)
downloadsamba-2fffc9a1b1fe2a1490e867bb38462e50c282d2b3.tar.gz
samba-2fffc9a1b1fe2a1490e867bb38462e50c282d2b3.tar.bz2
samba-2fffc9a1b1fe2a1490e867bb38462e50c282d2b3.zip
Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into v3-2-test
(This used to be commit 7dbfc7bdc65314466a83e8121b35c9bcb24b2631)
Diffstat (limited to 'source3/printing/lpq_parse.c')
-rw-r--r--source3/printing/lpq_parse.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c
index 56e228f219..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++;
}
@@ -444,7 +446,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 +513,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 +554,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 */