diff options
Diffstat (limited to 'get_rload.c')
-rw-r--r-- | get_rload.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/get_rload.c b/get_rload.c index c3f9dfb..c17598f 100644 --- a/get_rload.c +++ b/get_rload.c @@ -1,3 +1,6 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include <stdio.h> #include <X11/Intrinsic.h> @@ -44,6 +47,12 @@ void GetRLoadPoint( *(double *)call_data = 0.0; /* to be on the safe side */ if (fname == NULL) { +#ifdef HAVE_ASPRINTF + if (asprintf(&fname, "%s/whod.%s", _PATH_RWHODIR, resources.remote) < 0) { + perror("GetRLoadPoint: asprintf() failed"); + exit(1); + } +#else if ((fname = malloc(strlen(_PATH_RWHODIR)+strlen("/whod.")+strlen(resources.remote)+1)) == NULL) { fprintf(stderr,"GetRLoadPoint: malloc() failed\n"); exit(1); @@ -51,6 +60,7 @@ void GetRLoadPoint( strcpy(fname,_PATH_RWHODIR); strcat(fname,"/whod."); strcat(fname,resources.remote); +#endif } if ((f = open(fname, O_RDONLY, 0)) < 0) return; |