Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
spectrwm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
53586d8
)
Get actual LOGIN_NAME_MAX value from sysconf.
author
Reginald Kennedy
<rk@rejii.com>
Wed, 25 Jul 2012 22:45:40 +0000
(06:45 +0800)
committer
Reginald Kennedy
<rk@rejii.com>
Wed, 25 Jul 2012 22:45:40 +0000
(06:45 +0800)
spectrwm.c
patch
|
blob
|
history
diff --git
a/spectrwm.c
b/spectrwm.c
index
4ded077
..
0be0227
100644
(file)
--- a/
spectrwm.c
+++ b/
spectrwm.c
@@
-701,8
+701,8
@@
char *
expand_tilde(char *s)
{
struct passwd *pwd;
- int i;
- char user[LOGIN_NAME_MAX];
+ int i, max;
+ char *user;
const char *sc = s;
char *result;
@@
-715,6
+715,13
@@
expand_tilde(char *s)
}
++s;
+
+ if ((max = sysconf(_SC_LOGIN_NAME_MAX)) == -1)
+ errx(1, "expand_tilde: sysconf");
+
+ if ((user = calloc(1, max + 1)) == NULL)
+ errx(1, "expand_tilde: calloc");
+
for (i = 0; s[i] != '/' && s[i] != '\0'; ++i)
user[i] = s[i];
user[i] = '\0';