You are not logged in.
status.c (sp. line 110): https://github.com/Theta91/dotfiles/blo … tus.c#L110
status.h: https://github.com/Theta91/dotfiles/blo … c/status.h
Makefile: https://github.com/Theta91/dotfiles/blo … c/Makefile
In order to pick back up some of my lost C skills, I decided to mess around with writing a small statusline program ala the various dwm status bars. Anyway, I came across a curiosity: running a for loop w/ fmt_date works fine - once, then it segfaults*. The trace** indicated a problem with getenv that I eventually solved by using setenv() + tzset(), but this doesn't seem to be a problem with any other dwm status bars I've seen, which use functionally identical code [that also caused a segfault for me], so: why is this?
[I did go back and check my /etc/localtime and all that -- it's correct]
*i.e.
/: 13.9G /home: 284.9G | 100 HOME-7B52 | F | Fri 29 Aug '14 00:12:53
zsh: segmentation fault ./status
**trace:
#0 0x00007ffff775fead in getenv () from /usr/lib/libc.so.6
#1 0x00007ffff77d4988 in tzset_internal () from /usr/lib/libc.so.6
#2 0x00007ffff77d4d19 in __tz_convert () from /usr/lib/libc.so.6
#3 0x0000000000400e90 in fmt_date () at status.c:121
#4 0x0000000000400bff in main () at status.c:53
edit: It actually appears to disappear w/o tzset() when I actually allocate space for 'status' - perhaps that was the problem? *facepalm*
Last edited by Theta91 (2014-08-29 16:12:05)
Offline
edit: It actually appears to disappear w/o tzset() when I actually allocate space for 'status' - perhaps that was the problem? *facepalm*
If that was rhetorical, Go ahead and mark your thread as solved.
It was not rhetorical, yes, not having allocated space would do it. Still mark the thread as solved
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline