Timeline for mktime() seg fault
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 14, 2013 at 7:07 | history | edited | madth3 |
edited tags
|
|
Dec 3, 2012 at 7:17 | history | edited | Jonathan Leffler | CC BY-SA 3.0 |
Make the struct readily visible
|
Dec 3, 2012 at 7:12 | comment | added | Jonathan Leffler |
You could improve the reliability of the cpystruct code by using sizeof(temp.start) instead of 9 , etc. You could also use memmove() or memcpy() instead of strncpy() . But it isn't obvious that there's a problem in that function. You don't check the return value from strptime() ; if that fails, you've got a seriously misinitialized variable that you're passing to mktime() .
|
|
Dec 3, 2012 at 6:58 | comment | added | Olaf Dietsche |
I added cpystruct to your question. It's easier to read there. You can easily do that yourself. Just use the small "edit" link below the question.
|
|
Dec 3, 2012 at 6:56 | history | edited | Olaf Dietsche | CC BY-SA 3.0 |
Added cpystruct definition
|
Dec 3, 2012 at 3:33 | comment | added | Pinkgriptape92 |
icalevent cpystruct(icalevent temp, int is_location){ icalevent perm; strncpy(perm.start, temp.start, 9); strncpy(perm.stime, temp.stime, 7); strncpy(perm.end, temp.end, 9); strncpy(perm.etime, temp.etime, 7); strncpy(perm.rrule, temp.rrule, 9); strncpy(perm.rtime, temp.rtime, 7); if(is_location){ perm.location = strdup(temp.location); }else{ perm.location = NULL; } perm.summary = strdup(temp.summary); perm.sort_str = strdup(temp.sort_str); return perm; }
|
|
Dec 2, 2012 at 22:18 | comment | added | Olaf Dietsche |
How is cpystruct defined?
|
|
Dec 2, 2012 at 22:18 | history | edited | Olaf Dietsche |
edited tags
|
|
Dec 2, 2012 at 22:18 | review | First posts | |||
Dec 2, 2012 at 22:24 | |||||
Dec 2, 2012 at 22:17 | answer | added | Olaf Dietsche | timeline score: 1 | |
Dec 2, 2012 at 21:58 | history | asked | Pinkgriptape92 | CC BY-SA 3.0 |