Quellcode durchsuchen

Replace max flash led path with MAX_PATH

Kristian Vos vor 5 Monaten
Ursprung
Commit
33ce8d6288
1 geänderte Dateien mit 3 neuen und 2 gelöschten Zeilen
  1. 3 2
      src/flash.c

+ 3 - 2
src/flash.c

@@ -1,6 +1,7 @@
 #include <libmegapixels.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <limits.h>
 #include "flash.h"
 #include "util.h"
 
@@ -18,12 +19,12 @@ libmegapixels_flash_cleanup_flash_path(libmegapixels_camera *camera)
 char *
 libmegapixels_flash_get_led_path(const char *path)
 {
-    char *result = malloc(275);
+    char *result = malloc(PATH_MAX);
     if (result == NULL) {
         return NULL;
     }
 
-    snprintf(result, 275, "%s/flash_strobe", path);
+    snprintf(result, PATH_MAX, "%s/flash_strobe", path);
 
     return result;
 }