summary refs log tree commit diff
path: root/pkgs/tools/system/dell-command-configure/wrapper-lib.c
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-11-21 16:12:21 +0100
committerAlyssa Ross <hi@alyssa.is>2023-11-21 16:12:48 +0100
commit048a4cd441a59cbf89defb18bb45c9f0b4429b35 (patch)
treef8f5850ff05521ab82d65745894714a8796cbfb6 /pkgs/tools/system/dell-command-configure/wrapper-lib.c
parent030c5028b07afcedce7c5956015c629486cc79d9 (diff)
parent4c2d05dd6435d449a3651a6dd314d9411b5f8146 (diff)
downloadnixpkgs-rootfs.tar
nixpkgs-rootfs.tar.gz
nixpkgs-rootfs.tar.bz2
nixpkgs-rootfs.tar.lz
nixpkgs-rootfs.tar.xz
nixpkgs-rootfs.tar.zst
nixpkgs-rootfs.zip
Rebase onto e4ad989506ec7d71f7302cc3067abd82730a4beb HEAD rootfs
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'pkgs/tools/system/dell-command-configure/wrapper-lib.c')
-rwxr-xr-xpkgs/tools/system/dell-command-configure/wrapper-lib.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/tools/system/dell-command-configure/wrapper-lib.c b/pkgs/tools/system/dell-command-configure/wrapper-lib.c
new file mode 100755
index 00000000000..f93bcd58ab7
--- /dev/null
+++ b/pkgs/tools/system/dell-command-configure/wrapper-lib.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <string.h>
+
+static const char from[] =  "/usr/lib/ext/dell/omreg.cfg";
+static const char to[] = "@to@";
+
+int access_wrapper(const char *fn, int mode)
+{
+	if (!strcmp(fn, from)) {
+		printf("access_wrapper.c: Replacing path '%s' with '%s'\n", from, to);
+		fn = to;
+	}
+	return access(fn, mode);
+}
+
+FILE* fopen_wrapper(const char* fn, const char* mode)
+{
+	if (!strcmp(fn, from)) {
+		printf("fopen_wrapper.c: Replacing path '%s' with '%s'\n", from, to);
+		fn = to;
+	}
+	return fopen(fn, mode);
+}