diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-04-11 22:30:05 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-04-11 22:30:05 +0200 |
commit | 3ccb3b6b51e39b364f34cf7a1f3ed913c07fef68 (patch) | |
tree | 240b9633c0ce21e2aa4169c2c388830352941d85 | |
parent | update gitignore (diff) | |
download | blueshift-3ccb3b6b51e39b364f34cf7a1f3ed913c07fef68.tar.gz blueshift-3ccb3b6b51e39b364f34cf7a1f3ed913c07fef68.tar.bz2 blueshift-3ccb3b6b51e39b364f34cf7a1f3ed913c07fef68.tar.xz |
use limits.h
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/blueshift_drm_c.c | 8 | ||||
-rw-r--r-- | src/blueshift_drm_c.h | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/blueshift_drm_c.c b/src/blueshift_drm_c.c index a900685..8da5ccf 100644 --- a/src/blueshift_drm_c.c +++ b/src/blueshift_drm_c.c @@ -76,13 +76,13 @@ void blueshift_drm_close(void) */ int blueshift_drm_card_count(void) { - char pathname[4096]; + char pathname[PATH_MAX]; int count = 0; struct stat _attr; for (;;) { - snprintf(pathname, 4096, DRM_DEV_NAME, DRM_DIR_NAME, count); + snprintf(pathname, PATH_MAX, DRM_DEV_NAME, DRM_DIR_NAME, count); if (stat(pathname, &_attr)) break; count++; @@ -100,11 +100,11 @@ int blueshift_drm_card_count(void) */ int blueshift_drm_open_card(int card_index) { - char pathname[4096]; + char pathname[PATH_MAX]; int fd; int rc; - snprintf(pathname, 4096, DRM_DEV_NAME, DRM_DIR_NAME, card_index); + snprintf(pathname, PATH_MAX, DRM_DEV_NAME, DRM_DIR_NAME, card_index); fd = open(pathname, O_RDWR | O_CLOEXEC); if (fd < 0) diff --git a/src/blueshift_drm_c.h b/src/blueshift_drm_c.h index 527b205..36913cc 100644 --- a/src/blueshift_drm_c.h +++ b/src/blueshift_drm_c.h @@ -26,10 +26,14 @@ #include <sys/types.h> #include <fcntl.h> #include <alloca.h> +#include <limits.h> #ifndef O_CLOEXEC # define O_CLOEXEC 02000000 #endif +#ifndef PATH_MAX +# define PATH_MAX 4096 +#endif /* Requires video group */ #include <xf86drm.h> |