[sane-devel] [PATCH 2/2] add option to bind address
Matteo Croce
matteo at openwrt.org
Wed Sep 9 10:14:13 UTC 2015
---
frontend/saned.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/frontend/saned.c b/frontend/saned.c
index f1aaaaf..edd8673 100644
--- a/frontend/saned.c
+++ b/frontend/saned.c
@@ -247,6 +247,7 @@ static int num_handles;
static int debug;
static int run_mode;
static Handle *handle;
+static char *bind_addr;
static union
{
int w;
@@ -2807,7 +2808,7 @@ do_bindings (int *nfds, struct pollfd **fds)
hints.ai_flags = AI_PASSIVE;
hints.ai_socktype = SOCK_STREAM;
- err = getaddrinfo (NULL, SANED_SERVICE_NAME, &hints, &res);
+ err = getaddrinfo (bind_addr, SANED_SERVICE_NAME, &hints, &res);
if (err)
{
DBG (DBG_WARN, "do_bindings: \" %s \" service unknown on your host; you should add\n", SANED_SERVICE_NAME);
@@ -3275,7 +3276,7 @@ main (int argc, char *argv[])
numchildren = 0;
run_mode = SANED_RUN_INETD;
- while((c = getopt(argc, argv, "a:d:s:h")) != -1)
+ while((c = getopt(argc, argv, "a:d:s:b:h")) != -1)
{
switch(c) {
case 'a':
@@ -3288,6 +3289,9 @@ main (int argc, char *argv[])
run_mode = SANED_RUN_DEBUG;
debug = atoi(optarg);
break;
+ case 'b':
+ bind_addr = optarg;
+ break;
case 'h':
printf ("Usage: %s [ -a [ username ] | -d [ n ] | -s [ n ] ] | -h\n", argv[0]);
return;
--
2.1.4
More information about the sane-devel
mailing list