Browse Source

NCDIfConfig: Don't hardcode /sbin/modprobe, let the shell find it.

ambrop7 12 năm trước cách đây
mục cha
commit
4ef3943dbb
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      ncd/extra/NCDIfConfig.c

+ 2 - 1
ncd/extra/NCDIfConfig.c

@@ -50,6 +50,7 @@
 #include <generated/blog_channel_NCDIfConfig.h>
 
 #define IP_CMD "ip"
+#define MODPROBE_CMD "modprobe"
 #define RESOLVCONF_FILE "/etc/resolv.conf"
 #define RESOLVCONF_TEMP_FILE "/etc/resolv.conf-ncd-temp"
 #define TUN_DEVNODE "/dev/net/tun"
@@ -403,7 +404,7 @@ int NCDIfConfig_make_tuntap (const char *ifname, const char *owner, int tun)
 {
     // load tun module if needed
     if (access(TUN_DEVNODE, F_OK) < 0) {
-        if (run_command("/sbin/modprobe tun") != 0) {
+        if (run_command(MODPROBE_CMD" tun") != 0) {
             BLog(BLOG_ERROR, "modprobe tun failed");
         }
     }