summaryrefslogtreecommitdiffstats
path: root/jnlib
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2000-07-14 19:34:53 +0200
committerWerner Koch <wk@gnupg.org>2000-07-14 19:34:53 +0200
commit92cd25550836198cf1e3a6aac239eef98364359d (patch)
tree4fad355126fae79c93535e0e7c6afd91e384552a /jnlib
parentSee ChangeLog: Thu May 25 18:39:11 CEST 2000 Werner Koch (diff)
downloadgnupg2-92cd25550836198cf1e3a6aac239eef98364359d.tar.xz
gnupg2-92cd25550836198cf1e3a6aac239eef98364359d.zip
See ChangeLog: Fri Jul 14 19:38:23 CEST 2000 Werner Koch
Diffstat (limited to 'jnlib')
-rw-r--r--jnlib/ChangeLog6
-rw-r--r--jnlib/argparse.c4
-rw-r--r--jnlib/dotlock.c40
-rw-r--r--jnlib/dotlock.h1
4 files changed, 43 insertions, 8 deletions
diff --git a/jnlib/ChangeLog b/jnlib/ChangeLog
index a41901bf4..5bb8faf3b 100644
--- a/jnlib/ChangeLog
+++ b/jnlib/ChangeLog
@@ -1,3 +1,9 @@
+Fri Jul 14 19:38:23 CEST 2000 Werner Koch <wk@>
+
+ * argparse.c (default_strusage): Changed year of default copyright.
+
+ * dotlock.c (disable_dotlock): New.
+
Mon Jan 24 13:04:28 CET 2000 Werner Koch <wk@gnupg.de>
* README: New.
diff --git a/jnlib/argparse.c b/jnlib/argparse.c
index 3f778053d..6293d3eb3 100644
--- a/jnlib/argparse.c
+++ b/jnlib/argparse.c
@@ -1,5 +1,5 @@
/* [argparse.c wk 17.06.97] Argument Parser for option handling
- * Copyright (C) 1998,1999 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
* This file is part of GnuPG.
*
* GnuPG is free software; you can redistribute it and/or modify
@@ -899,7 +899,7 @@ strusage( int level )
switch( level ) {
case 11: p = "foo"; break;
case 13: p = "0.0"; break;
- case 14: p = "Copyright (C) 1999 Free Software Foundation, Inc."; break;
+ case 14: p = "Copyright (C) 2000 Free Software Foundation, Inc."; break;
case 15: p =
"This program comes with ABSOLUTELY NO WARRANTY.\n"
"This is free software, and you are welcome to redistribute it\n"
diff --git a/jnlib/dotlock.c b/jnlib/dotlock.c
index 8e61f7a03..29ab65dff 100644
--- a/jnlib/dotlock.c
+++ b/jnlib/dotlock.c
@@ -1,5 +1,5 @@
/* dotlock.c - dotfile locking
- * Copyright (C) 1998,2000 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 2000 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -42,14 +42,22 @@ struct dotlock_handle {
char *tname; /* name of lockfile template */
char *lockname; /* name of the real lockfile */
int locked; /* lock status */
+ int disable; /* locking */
};
static DOTLOCK all_lockfiles;
+static int never_lock;
static int read_lockfile( const char *name );
static void remove_lockfiles(void);
+void
+disable_dotlock(void)
+{
+ never_lock = 1;
+}
+
/****************
* Create a lockfile with the given name and return an object of
* type DOTLOCK which may be used later to actually do the lock.
@@ -88,6 +96,16 @@ create_dotlock( const char *file_to_lock )
return NULL;
h = jnlib_xcalloc( 1, sizeof *h );
+ if( never_lock ) {
+ h->disable = 1;
+ #ifdef _REENTRANT
+ /* fixme: aquire mutex on all_lockfiles */
+ #endif
+ h->next = all_lockfiles;
+ all_lockfiles = h;
+ return h;
+ }
+
#ifndef HAVE_DOSISH_SYSTEM
sprintf( pidstr, "%10d\n", (int)getpid() );
/* fixme: add the hostname to the second line (FQDN or IP addr?) */
@@ -191,6 +209,10 @@ make_dotlock( DOTLOCK h, long timeout )
const char *maybe_dead="";
int backoff=0;
+ if( h->disable ) {
+ return 0;
+ }
+
if( h->locked ) {
log_debug("oops, `%s' is already locked\n", h->lockname );
return 0;
@@ -259,6 +281,10 @@ release_dotlock( DOTLOCK h )
#else
int pid;
+ if( h->disable ) {
+ return 0;
+ }
+
if( !h->locked ) {
log_debug("oops, `%s' is not locked\n", h->lockname );
return 0;
@@ -333,11 +359,13 @@ remove_lockfiles()
while( h ) {
h2 = h->next;
- if( h->locked )
- unlink( h->lockname );
- unlink(h->tname);
- jnlib_free(h->tname);
- jnlib_free(h->lockname);
+ if( !h->disable ) {
+ if( h->locked )
+ unlink( h->lockname );
+ unlink(h->tname);
+ jnlib_free(h->tname);
+ jnlib_free(h->lockname);
+ }
jnlib_free(h);
h = h2;
}
diff --git a/jnlib/dotlock.h b/jnlib/dotlock.h
index d54219e23..74ac876fa 100644
--- a/jnlib/dotlock.h
+++ b/jnlib/dotlock.h
@@ -24,6 +24,7 @@
struct dotlock_handle;
typedef struct dotlock_handle *DOTLOCK;
+void disable_dotlock(void);
DOTLOCK create_dotlock( const char *file_to_lock );
int make_dotlock( DOTLOCK h, long timeout );
int release_dotlock( DOTLOCK h );