Note that there are some explanatory texts on larger screens.

plurals
  1. POSIGABRT in C Linux
    text
    copied!<p>i received an strange SIGABRT in my C program, tha's my function where the problem appears:</p> <pre><code>int get_interface_mac_addr(Interface* iface) { char arquivo[10]; sprintf(arquivo, "/sys/class/net/%s/address", iface-&gt;interface_name); int fd; fd = open(arquivo, O_RDONLY, 0); char buf[100]; read(fd, buf, sizeof (buf)); buf[strlen(buf) - 1] = '\0'; strcpy(iface-&gt;interface_mac_addr, buf); close(fd); return GET_MAC_ADDR_SUCCESS; } </code></pre> <p>The error happends at "}", the last line of code.</p> <p>I try to debug with GDB, but I'm new at this, so I do not understand many things that GDB tells me. Below is the output from GDB:</p> <pre><code>Core was generated by `./vfirewall-monitor'. Program terminated with signal 6, Aborted. #0 0x00007f36c043b425 in __GI_raise (sig=&lt;optimized out&gt;) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 0x00007f36c043b425 in __GI_raise (sig=&lt;optimized out&gt;) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1 0x00007f36c043eb8b in __GI_abort () at abort.c:91 #2 0x00007f36c047939e in __libc_message (do_abort=2, fmt=0x7f36c058157f "*** %s ***: %s terminated\n") at ../sysdeps/unix/sysv/linux/libc_fatal.c:201 #3 0x00007f36c050ff47 in __GI___fortify_fail (msg=0x7f36c0581567 "stack smashing detected") at fortify_fail.c:32 #4 0x00007f36c050ff10 in __stack_chk_fail () at stack_chk_fail.c:29 #5 0x00000000004029be in get_interface_mac_addr (iface=0x7f36b4004560) at interfaces.c:340 #6 0x00000000004022c9 in get_interfaces_info (iface=0x7f36b4004560) at interfaces.c:87 #7 0x0000000000402d9d in get_all_system_info () at kernel.c:109 #8 0x00007f36c07cce9a in start_thread (arg=0x7f36bb729700) at pthread_create.c:308 #9 0x00007f36c04f93fd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #10 0x0000000000000000 in ?? () (gdb) </code></pre> <p>Someone know whats going on in this case? I do something wrong and a can see what is?</p> <p>many thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload