summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-09-27 11:10:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:03 -0500
commit04b7fb64e1e84f6c2cf987eb6497e2d25727a59d (patch)
tree9ab745999924231679cbafb44a01824cc96b2d0c /source4
parent3f41ddd882054181e19f669513411cee4f6f76c1 (diff)
downloadsamba-04b7fb64e1e84f6c2cf987eb6497e2d25727a59d.tar.gz
samba-04b7fb64e1e84f6c2cf987eb6497e2d25727a59d.tar.bz2
samba-04b7fb64e1e84f6c2cf987eb6497e2d25727a59d.zip
r10533: Eliminate another use of next_token()
(This used to be commit cff17c6ac7e4fad730b6ef05e09499fff32c694a)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/util_sock.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source4/lib/util_sock.c b/source4/lib/util_sock.c
index d60fbb3451..be968666a7 100644
--- a/source4/lib/util_sock.c
+++ b/source4/lib/util_sock.c
@@ -21,20 +21,16 @@
#include "includes.h"
#include "system/network.h"
-#include "pstring.h"
-
enum SOCK_OPT_TYPES {OPT_BOOL,OPT_INT,OPT_ON};
-typedef struct smb_socket_option {
+static const struct {
const char *name;
int level;
int option;
int value;
int opttype;
-} smb_socket_option;
-
-static const smb_socket_option socket_options[] = {
+} socket_options[] = {
{"SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE, 0, OPT_BOOL},
{"SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR, 0, OPT_BOOL},
{"SO_BROADCAST", SOL_SOCKET, SO_BROADCAST, 0, OPT_BOOL},
@@ -76,9 +72,11 @@ static const smb_socket_option socket_options[] = {
****************************************************************************/
void set_socket_options(int fd, const char *options)
{
- fstring tok;
+ const char **options_list = str_list_make(NULL, options, " \t,");
+ int j;
- while (next_token(&options,tok," \t,", sizeof(tok))) {
+ for (j = 0; options_list[j]; j++) {
+ const char *tok = options_list[j];
int ret=0,i;
int value = 1;
char *p;
@@ -121,5 +119,7 @@ void set_socket_options(int fd, const char *options)
if (ret != 0)
DEBUG(0,("Failed to set socket option %s (Error %s)\n",tok, strerror(errno) ));
}
+
+ talloc_free(options_list);
}