diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2009-10-10 06:16:23 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2009-10-10 06:16:23 +0200 |
commit | 69a2548913619eb81dcb6c03e27585e02fe057cd (patch) | |
tree | 21fd934d184d8de3e0f58de8f9299da98cd2fe2e /src/rccxml.c | |
parent | 9e6ed416e3368b23c867e54dd2f7cc18f75a1c6e (diff) | |
download | librcc-69a2548913619eb81dcb6c03e27585e02fe057cd.tar.gz librcc-69a2548913619eb81dcb6c03e27585e02fe057cd.tar.bz2 librcc-69a2548913619eb81dcb6c03e27585e02fe057cd.tar.xz librcc-69a2548913619eb81dcb6c03e27585e02fe057cd.zip |
Support systems without lockf (OpenSolaris), check GTK1 headers in configure.in, complain on missing macros in autogen.sh, patches by Ivan Borzenkov and Colin Watson for eglibc compatibility
Diffstat (limited to 'src/rccxml.c')
-rw-r--r-- | src/rccxml.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/rccxml.c b/src/rccxml.c index 03230d0..1db5788 100644 --- a/src/rccxml.c +++ b/src/rccxml.c @@ -340,7 +340,12 @@ int rccSave(rcc_context ctx, const char *name) { sprintf(config,"%s/.rcc/%s.xml",rcc_home_dir,name); fd = open(config, O_CREAT|O_RDWR,00644); if (fd == -1) goto clear; + +#if defined(HAVE_FLOCK) flock(fd, LOCK_EX); +#elif defined(HAVE_LOCKF) + lockf(fd, F_LOCK, 1); +#endif if ((!fstat(fd, &st))&&(st.st_size)) { doc = xmlReadFd(fd, config, NULL, 0); @@ -463,7 +468,13 @@ clear: xmlFreeDoc(doc); } fsync(fd); - flock(fd, LOCK_UN); + +#if defined(HAVE_FLOCK) + flock(fd, LOCK_UN); +#elif defined(HAVE_LOCKF) + lockf(fd, F_ULOCK, 1); +#endif + close(fd); } free(config); @@ -516,11 +527,22 @@ int rccLoad(rcc_context ctx, const char *name) { free(config); if (fd != -1) { +#if defined(HAVE_FLOCK) flock(fd, LOCK_EX); +#elif defined(HAVE_LOCKF) + lockf(fd, F_LOCK, 1); +#endif + if ((!fstat(fd, &st))&&(st.st_size)) { doc = xmlReadFd(fd, name, NULL, 0); } + +#if defined(HAVE_FLOCK) flock(fd, LOCK_UN); +#elif defined(HAVE_LOCKF) + lockf(fd, F_ULOCK, 1); +#endif + close(fd); if (doc) { @@ -533,11 +555,22 @@ int rccLoad(rcc_context ctx, const char *name) { } if (sysfd != -1) { +#if defined(HAVE_FLOCK) flock(sysfd, LOCK_EX); +#elif defined(HAVE_LOCKF) + lockf(sysfd, F_LOCK, 1); +#endif + if ((!fstat(sysfd, &st))&&(st.st_size)) { sysdoc = xmlReadFd(sysfd, name, NULL, 0); } + +#if defined(HAVE_FLOCK) flock(sysfd, LOCK_UN); +#elif defined(HAVE_LOCKF) + lockf(sysfd, F_ULOCK, 1); +#endif + close(sysfd); if (sysdoc) { |