From: franklahm Date: Tue, 5 Jan 2010 13:48:47 +0000 (+0000) Subject: Add static getcwd and use it for debugging in ad_open X-Git-Tag: branch-dircache-rewrite-start~34 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=9685b2154cf9f48f586698e1f79d89659efcbe7b Add static getcwd and use it for debugging in ad_open --- diff --git a/include/atalk/util.h b/include/atalk/util.h index 02a0cc62..52c56280 100644 --- a/include/atalk/util.h +++ b/include/atalk/util.h @@ -1,5 +1,5 @@ /* - * $Id: util.h,v 1.16 2009-11-23 18:17:30 didg Exp $ + * $Id: util.h,v 1.17 2010-01-05 13:48:47 franklahm Exp $ */ #ifndef _ATALK_UTIL_H @@ -236,3 +236,14 @@ extern void apply_ip_mask(struct sockaddr *ai, int maskbits); * IPv6 mapped IPv4 addresses are treated as IPv4 addresses. */ extern int compare_ip(const struct sockaddr *sa1, const struct sockaddr *sa2); + +/****************************************************************** + * unix.c + *****************************************************************/ + +/*! + * @brief get cwd in static buffer + * + * @returns pointer to path or pointer to error messages on error + */ +extern const char *getcwdpath(void); diff --git a/libatalk/adouble/ad_open.c b/libatalk/adouble/ad_open.c index d8ebc8cc..6b6e09ca 100644 --- a/libatalk/adouble/ad_open.c +++ b/libatalk/adouble/ad_open.c @@ -1,5 +1,5 @@ /* - * $Id: ad_open.c,v 1.62 2010-01-05 12:06:34 franklahm Exp $ + * $Id: ad_open.c,v 1.63 2010-01-05 13:48:47 franklahm Exp $ * * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) * Copyright (c) 1990,1991 Regents of The University of Michigan. @@ -1365,6 +1365,7 @@ int ad_open( const char *path, int adflags, int oflags, int mode, struct adouble * here. * if ((oflags & O_CREAT) ==> (oflags & O_RDWR) */ + LOG(logtype_default, log_debug, "ad_open: creating new adouble file: %s/%s", getcwdpath(), ad_p); admode = mode; errno = 0; st_invalid = ad_mode_st(ad_p, &admode, &st_dir); diff --git a/libatalk/util/Makefile.am b/libatalk/util/Makefile.am index d6351464..f8eeb6b4 100644 --- a/libatalk/util/Makefile.am +++ b/libatalk/util/Makefile.am @@ -21,4 +21,5 @@ libutil_la_SOURCES = \ strcasestr.c \ strdicasecmp.c \ strlcpy.c \ - volinfo.c + volinfo.c \ + unix.c diff --git a/libatalk/util/unix.c b/libatalk/util/unix.c new file mode 100644 index 00000000..beb9ab5a --- /dev/null +++ b/libatalk/util/unix.c @@ -0,0 +1,48 @@ +/* + $Id: unix.c,v 1.1 2010-01-05 13:48:47 franklahm Exp $ + Copyright (c) 2010 Frank Lahm + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +extern const char *getcwdpath(void) +{ + static char cwd[MAXPATHLEN + 1]; + char *p; + + if ((p = getcwd(&cwd, MAXPATHLEN)) != NULL) + return p; + else + return strerror(errno); +}