X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=blobdiff_plain;f=etc%2Fcnid_dbd%2Fcnid_metad.c;h=d6b62469bcefe066bfdfa6701d665f1ce8f93df9;hp=a383522ee9cd58806bd0dfa2b742d8970dddd69c;hb=75fe310224dffb96868d7f2cb1ec9125a84f2a08;hpb=39cc274e6372f88f9cec1c5703f9a19d1ede3f5a diff --git a/etc/cnid_dbd/cnid_metad.c b/etc/cnid_dbd/cnid_metad.c index a383522e..d6b62469 100644 --- a/etc/cnid_dbd/cnid_metad.c +++ b/etc/cnid_dbd/cnid_metad.c @@ -1,5 +1,5 @@ /* - * $Id: cnid_metad.c,v 1.20 2009-10-29 11:19:23 didg Exp $ + * $Id: cnid_metad.c,v 1.21 2009-11-05 14:38:07 franklahm Exp $ * * Copyright (C) Joerg Lenneis 2003 * All Rights Reserved. See COPYING. @@ -29,14 +29,13 @@ #include "config.h" #endif /* HAVE_CONFIG_H */ -#include - -#ifdef HAVE_UNISTD_H -#undef _USE_GNU_SOURCE -#define _USE_GNU_SOURCE +#ifdef linux +#define _GNU_SOURCE +#endif #include #undef __USE_GNU -#endif /* HAVE_UNISTD_H */ + +#include #include #include #include @@ -87,14 +86,14 @@ #define USE_SETRESUID 1 #define SWITCH_TO_GID(gid) ((setresgid(gid,gid,gid) < 0 || setgid(gid) < 0) ? -1 : 0) #define SWITCH_TO_UID(uid) ((setresuid(uid,uid,uid) < 0 || setuid(uid) < 0) ? -1 : 0) -#endif -#else +#endif /* USE_SETRESUID */ +#else /* ! linux */ #ifndef USE_SETEUID #define USE_SETEUID 1 #define SWITCH_TO_GID(gid) ((setegid(gid) < 0 || setgid(gid) < 0) ? -1 : 0) #define SWITCH_TO_UID(uid) ((setuid(uid) < 0 || seteuid(uid) < 0 || setuid(uid) < 0) ? -1 : 0) -#endif -#endif +#endif /* USE_SETEUID */ +#endif /* linux */ #include #include @@ -115,7 +114,7 @@ static volatile sig_atomic_t sigchild = 0; * to reconnect every 5 secondes, catch it */ #define MAXVOLS 512 #define DEFAULTHOST "localhost" -#define DEFAULTPORT 4700 +#define DEFAULTPORT "4700" struct server { char *name; @@ -416,7 +415,7 @@ int main(int argc, char *argv[]) int status; char *dbdpn = _PATH_CNID_DBD; char *host = DEFAULTHOST; - u_int16_t port = DEFAULTPORT; + char *port = DEFAULTPORT; struct db_param *dbp; int i; int cc; @@ -454,7 +453,7 @@ int main(int argc, char *argv[]) } break; case 'p': - port = atoi(optarg); + port = strdup(optarg); break; case 's': dbdpn = strdup(optarg);