Skip to content

Instantly share code, notes, and snippets.

@DaisukeDaisuke
Created January 3, 2021 08:17
Show Gist options
  • Select an option

  • Save DaisukeDaisuke/a585d489b95d0b12ed674ea91f42e73f to your computer and use it in GitHub Desktop.

Select an option

Save DaisukeDaisuke/a585d489b95d0b12ed674ea91f42e73f to your computer and use it in GitHub Desktop.
diff --git a/a.diff b/a.diff
deleted file mode 100644
index e69de29b..00000000
diff --git a/n.deff b/n.deff
deleted file mode 100644
index e69de29b..00000000
diff --git a/src/network/resolvconf.c b/src/network/resolvconf.c
index ceabf080..4ed5b80e 100644
--- a/src/network/resolvconf.c
+++ b/src/network/resolvconf.c
@@ -12,13 +12,19 @@ int __get_resolv_conf(struct resolvconf *conf, char *search, size_t search_sz)
unsigned char _buf[256];
FILE *f, _f;
int nns = 0;
+ char *confdir;
conf->ndots = 1;
conf->timeout = 5;
conf->attempts = 2;
if (search) *search = 0;
- f = __fopen_rb_ca("/etc/resolv.conf", &_f, _buf, sizeof _buf);
+ if ((confdir = getenv('LESMI_RESOLV_CONF_DIR')) != NULL) {
+ f = __fopen_rb_ca(confdir, &_f, _buf, sizeof _buf);
+ }else{
+ f = __fopen_rb_ca("/etc/resolv.conf", &_f, _buf, sizeof _buf);
+ }
+
if (!f) switch (errno) {
case ENOENT:
case ENOTDIR:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment