diff options
author | Jon Lund Steffensen <jonlst@gmail.com> | 2016-10-15 11:25:36 -0400 |
---|---|---|
committer | Jon Lund Steffensen <jonlst@gmail.com> | 2016-10-15 11:38:20 -0400 |
commit | 05737ed33c94d854715cf63ff9b126e84d3e583f (patch) | |
tree | 952f087210f498e5312c0c7b21b8646586708cb2 /src/gamma-drm.c | |
parent | Merge pull request #377 from FabioBeneditto/master (diff) | |
download | redshift-ng-05737ed33c94d854715cf63ff9b126e84d3e583f.tar.gz redshift-ng-05737ed33c94d854715cf63ff9b126e84d3e583f.tar.bz2 redshift-ng-05737ed33c94d854715cf63ff9b126e84d3e583f.tar.xz |
drm: Avoid using alloca()
Diffstat (limited to 'src/gamma-drm.c')
-rw-r--r-- | src/gamma-drm.c | 5 |
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; } |