I'm checking out lp5250d...   and attempting to port it to FreeBSD.
I'm always the last to try these things, arent I? :)

When I specify a tracefile with the -t option, lp5250d crashes with a
"bus error", and dumps core.  Taking a look at the core dump, I see that
it is crashing on this statement:
     strcpy(logname, optarg);
which occurs around line 114 of lp5250d.c

The reason for this appears to be the statement:
     char logname[20] = "";
which occurs around line 50 of lp5250d.c

Now, I'm primarily an AS/400 RPG programmer, so correct me if I'm wrong,
but is that even valid syntax in C?   If it is, isn't it telling the
compiler to make a 1-byte constant that just contains a string terminator,
and then change the address of the logname variable to be the same as
that constant?   

At any rate, changing the line to:
     char logname[20];
and adding a line at the top of main():
     logname[0] = '\0';

appears to solve this problem.   But... is it really desirable to have
logname be only 20 chars long?  Is it really a good idea to strcpy to such
a small area of memory, when it'd be so easy to type a pathname longer
than 20 bytes that'd cause it to overflow?  


NEXT PROBLEM...  (and the reason I wanted a tracefile...)

When I start up lp5250d, it connects to the AS/400 just fine.  It starts
the print writer, and I am able to send a printout to it.   The printout
gets downloaded and removed from the spool.  so far so good, right?

But then it doesnt print.   At all.   The daemon appears to have stopped
running after it gets the data, as it no longer shows up in my "ps".  
I look at the tracefile, and there are no errors there.

I'll keep looking at it, maybe I can figure out whats happening...  but I
thought I'd say something, in case someone out there knows why it might
die silently without telling me whats wrong...

Thanks!



+---
| This is the LINUX5250 Mailing List!
| To submit a new message, send your mail to [EMAIL PROTECTED]
| To subscribe to this list send email to [EMAIL PROTECTED]
| To unsubscribe from this list send email to [EMAIL PROTECTED]
| Questions should be directed to the list owner/operator: [EMAIL PROTECTED]
+---

Reply via email to