summaryrefslogtreecommitdiff
path: root/repo/openrgb/0001-fix-build.patch
blob: f9371d996cc21fb80fee2b7e6348a38a9066f859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff --git a/i2c_smbus/i2c_smbus_linux.cpp b/i2c_smbus/i2c_smbus_linux.cpp
index 33d1494b..1c5ff27b 100644
--- a/i2c_smbus/i2c_smbus_linux.cpp
+++ b/i2c_smbus/i2c_smbus_linux.cpp
@@ -14,6 +14,24 @@
 #include <sys/ioctl.h>
 #include <cstring>
 
+#ifndef HAVE_CANONICALIZE_FILE_NAME
+#include <limits.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+static char * canonicalize_file_name(const char *path)
+{
+       char buf[PATH_MAX] = { };
+
+       snprintf(buf, sizeof(buf) - 1, "%s", path);
+
+       if (!realpath(path, buf))
+               return NULL;
+
+       return strdup(buf);
+}
+#endif
+
 s32 i2c_smbus_linux::i2c_smbus_xfer(u8 addr, char read_write, u8 command, int size, union i2c_smbus_data* data)
 {