aboutsummaryrefslogtreecommitdiffstats
path: root/util/dotlock.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-12-29 13:47:31 +0000
committerWerner Koch <[email protected]>1998-12-29 13:47:31 +0000
commit6e08b235cb73d3c8e83218a94f9a2d356f2709ac (patch)
treec5a0a706b32d530cb661a62ec9439109bce5a75c /util/dotlock.c
parentSee ChangeLog: Wed Dec 23 17:12:24 CET 1998 Werner Koch (diff)
downloadgnupg-6e08b235cb73d3c8e83218a94f9a2d356f2709ac.tar.gz
gnupg-6e08b235cb73d3c8e83218a94f9a2d356f2709ac.zip
See ChangeLog: Tue Dec 29 14:41:47 CET 1998 Werner Koch
Diffstat (limited to 'util/dotlock.c')
-rw-r--r--util/dotlock.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/util/dotlock.c b/util/dotlock.c
index 794a362f7..69a38d696 100644
--- a/util/dotlock.c
+++ b/util/dotlock.c
@@ -66,7 +66,10 @@ make_dotlock( const char *file_to_lock, long timeout )
/* fixme: add the hostname to the second line (FQDN or IP addr?) */
/* create a temporary file */
- #if SYS_NMLN < 8
+ #if defined(SYS_NMLN) && SYS_NMLN < 8
+ #error Aiiih
+ #elif !defined(SYS_NMLN) && MAXHOSTNAMELEN < 8
+ /* (SunOS uses a structure of size MAXHOSTNAMELEN) */
#error Aiiih
#endif
if( uname( &uts ) )
@@ -96,17 +99,17 @@ make_dotlock( const char *file_to_lock, long timeout )
S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR );
} while( fd == -1 && errno == EINTR );
if( fd == -1 ) {
- log_error( "failed to create temporary file '%s': %s\n",
+ log_error( "failed to create temporary file `%s': %s\n",
tname, strerror(errno));
goto leave;
}
have_tfile = 1;
if( write(fd, pidstr, 11 ) != 11 ) {
- log_fatal( "error writing to '%s': %s\n", tname, strerror(errno) );
+ log_fatal( "error writing to `%s': %s\n", tname, strerror(errno) );
goto leave;
}
if( close(fd) ) {
- log_error( "error closing '%s': %s\n", tname, strerror(errno));
+ log_error( "error closing `%s': %s\n", tname, strerror(errno));
goto leave;
}
fd = -1;
@@ -197,7 +200,7 @@ release_dotlock( const char *lockfile )
return -1;
}
if( remove( lockfile ) ) {
- log_error( "release_dotlock: error removing lockfile '%s'",
+ log_error( "release_dotlock: error removing lockfile `%s'",
lockfile);
return -1;
}
@@ -217,12 +220,12 @@ read_lockfile( const char *name )
if( (fd = open(name, O_RDONLY)) == -1 ) {
int e = errno;
- log_debug("error opening lockfile '%s': %s\n", name, strerror(errno) );
+ log_debug("error opening lockfile `%s': %s\n", name, strerror(errno) );
errno = e;
return -1;
}
if( read(fd, pidstr, 10 ) != 10 ) {
- log_debug("error reading lockfile '%s'", name );
+ log_debug("error reading lockfile `%s'", name );
close(fd);
errno = 0;
return -1;
@@ -230,7 +233,7 @@ read_lockfile( const char *name )
close(fd);
pid = atoi(pidstr);
if( !pid || pid == -1 ) {
- log_error("invalid pid %d in lockfile '%s'", pid, name );
+ log_error("invalid pid %d in lockfile `%s'", pid, name );
errno = 0;
return -1;
}