Re: init_agent() crashing
rosy <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <CAMcwpM6yaEjztz8cqTD9YuFhbOCFWnN6Csi7e9DLZsbfoZbsiw@mail.gmail.com> |
Hi Bart,
Thanks for your reply. It did work. But i would like to appreciate if
you would let me know why it works..
0xff in binary is 11111111.. and by doing tolower((*cp) & 0xff)..it
will set the corresponding bits which are 1 in (*cp)..
But how it solved the crashing issue ??
Now again it crashing at while (*from != 0 && !isspace(*from)) ...
I did !isspace(*from & 0xff) ..but it's not working.. :(
Why its crashing when Its calling all the c -related functions.. Is
there any problem with my cross compiler..??
Would appreciate if you can guide me on this..
Thanks in advance..
char *
01534 copy_nword(char *from, char *to, int len)
01535 {
01536 char quote;
01537 if (!from || !to)
01538 return NULL;
01539 if ((*from == '\"') || (*from == '\'')) {
01540 quote = *(from++);
01541 while ((*from != quote) && (*from != 0)) {
01542 if ((*from == '\\') && (*(from + 1) != 0)) {
01543 if (len > 0) { /* don't copy beyond len bytes */
01544 *to++ = *(from + 1);
01545 if (--len == 0)
01546 *(to - 1) = '\0'; /* null protect
the last spot */
01547 }
01548 from = from + 2;
01549 } else {
01550 if (len > 0) { /* don't copy beyond len bytes */
01551 *to++ = *from++;
01552 if (--len == 0)
01553 *(to - 1) = '\0'; /* null protect
the last spot */
01554 } else
01555 from++;
01556 }
01557 }
01558 if (*from == 0) {
01559 DEBUGMSGTL(("read_config_copy_word",
01560 "no end quote found in config string\n"));
01561 } else
01562 from++;
01563 } else {
01564 while (*from != 0 && !isspace(*from)) {
01565 if ((*from == '\\') && (*(from + 1) != 0)) {
01566 if (len > 0) { /* don't copy beyond len bytes */
01567 *to++ = *(from + 1);
01568 if (--len == 0)
01569 *(to - 1) = '\0'; /* null protect
the last spot */
01570 }
01571 from = from + 2;
01572 } else {
01573 if (len > 0) { /* don't copy beyond len bytes */
01574 *to++ = *from++;
01575 if (--len == 0)
01576 *(to - 1) = '\0'; /* null protect
the last spot */
01577 } else
01578 from++;
01579 }
01580 }
01581 }
01582 if (len > 0)
01583 *to = 0;
01584 from = skip_white(from);
01585 return (from);
01586 } /* copy_word */
01587
On Mon, Feb 13, 2012 at 4:44 PM, Bart Van Assche <[email protected]> wrote:
> On Mon, Feb 13, 2012 at 12:11 PM, rosy <[email protected]> wrote:
>>
>> Thanks for your reply. Actually by debugging the code what I am
>> finding is that..its crashing inside the name_hash(..) func..while
>> executing line
>>
>> hash += tolower((unsigned char)(*cp));
>>
>> I was assuming, there is some problem with my cross compiler..but when
>> I just wrote a simple program with toLower..its working fine. Since I
>> am totally new to SNMp so not getting any idea where how to proceed
>> next.
>
>
> You could try to rewrite that statement as follows:
>
> hash += tolower(*cp & 0xff);
>
> If that helps, it's a compiler bug.
>
> Bart.
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users