aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon Lund Steffensen <jonlst@gmail.com>2016-10-15 11:25:36 -0400
committerJon Lund Steffensen <jonlst@gmail.com>2016-10-15 11:38:20 -0400
commit05737ed33c94d854715cf63ff9b126e84d3e583f (patch)
tree952f087210f498e5312c0c7b21b8646586708cb2 /src
parentMerge pull request #377 from FabioBeneditto/master (diff)
downloadredshift-ng-05737ed33c94d854715cf63ff9b126e84d3e583f.tar.gz
redshift-ng-05737ed33c94d854715cf63ff9b126e84d3e583f.tar.bz2
redshift-ng-05737ed33c94d854715cf63ff9b126e84d3e583f.tar.xz
drm: Avoid using alloca()
Diffstat (limited to 'src')
-rw-r--r--src/gamma-drm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gamma-drm.c b/src/gamma-drm.c
index d15f3f6..c2ac4bd 100644
--- a/src/gamma-drm.c
+++ b/src/gamma-drm.c
@@ -21,7 +21,6 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
-#include <alloca.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -60,7 +59,7 @@ drm_start(drm_state_t *state)
{
/* Acquire access to a graphics card. */
long maxlen = strlen(DRM_DIR_NAME) + strlen(DRM_DEV_NAME) + 10;
- char *pathname = alloca(maxlen * sizeof(char));
+ char pathname[maxlen];
sprintf(pathname, DRM_DEV_NAME, DRM_DIR_NAME, state->card_num);
@@ -69,6 +68,8 @@ drm_start(drm_state_t *state)
/* TODO check if access permissions, normally root or
membership of the video group is required. */
perror("open");
+ fprintf(stderr, _("Failed to open DRM device: %s\n"),
+ pathname);
return -1;
}