diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-03-30 21:30:45 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-03-30 21:30:45 +0200 |
commit | ee770c2346eb37e0dcb8b6cf3eaacf3d8efd6bbc (patch) | |
tree | 58f05092be1a17a939e861f8cadcda1b6ca2ecef /sanei/sanei_access.c | |
parent | 0da9e21872802cfc6e975b1ebaf9efb9e5934d84 (diff) | |
parent | fef76e17ed4c607ea73b81279f9ef1d7121be900 (diff) |
Merge branch 'release/experimental/1.0.29-1_experimental1'experimental/1.0.29-1_experimental1
Diffstat (limited to 'sanei/sanei_access.c')
-rw-r--r-- | sanei/sanei_access.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sanei/sanei_access.c b/sanei/sanei_access.c index b77cdd9..cb19c5c 100644 --- a/sanei/sanei_access.c +++ b/sanei/sanei_access.c @@ -80,10 +80,10 @@ #ifdef ENABLE_LOCKING /** get the status/owner of a lock file * - * The function tries to open an existing lockfile. On success, it reads out + * The function tries to open an existing lockfile. On success, it reads out * the pid which is stored inside and tries to find out more about the status * of the process with the corresponding PID. - * + * * @param fn - the complete filename of the lockfile to check * @return * - PROCESS_SELF - the calling process is owner of the lockfile @@ -96,10 +96,10 @@ get_lock_status( char *fn ) char pid_buf[PID_BUFSIZE]; int fd, status; pid_t pid; - + fd = open( fn, O_RDONLY ); if( fd < 0 ) { - DBG( 2, "does_process_exist: open >%s< failed: %s\n", + DBG( 2, "does_process_exist: open >%s< failed: %s\n", fn, strerror(errno)); return PROCESS_OTHER; } @@ -155,7 +155,7 @@ sanei_access_init( const char *backend ) DBG( 2, "sanei_access_init: >%s<\n", backend); } -SANE_Status +SANE_Status sanei_access_lock( const char *devicename, SANE_Word timeout ) { #ifdef ENABLE_LOCKING @@ -164,7 +164,7 @@ sanei_access_lock( const char *devicename, SANE_Word timeout ) int fd, to, i; #endif - DBG( 2, "sanei_access_lock: devname >%s<, timeout: %u\n", + DBG( 2, "sanei_access_lock: devname >%s<, timeout: %u\n", devicename, timeout ); #ifndef ENABLE_LOCKING return SANE_STATUS_GOOD; @@ -179,7 +179,7 @@ sanei_access_lock( const char *devicename, SANE_Word timeout ) fd = open( fn, O_CREAT | O_EXCL | O_WRONLY, 0644 ); if (fd < 0) { - + if (errno == EEXIST) { switch( get_lock_status( fn )) { case PROCESS_DEAD: @@ -198,7 +198,7 @@ sanei_access_lock( const char *devicename, SANE_Word timeout ) DBG( 2, "sanei_access_lock: lock exists, waiting...\n" ); sleep(1); } else { - DBG( 1, "sanei_access_lock: open >%s< failed: %s\n", + DBG( 1, "sanei_access_lock: open >%s< failed: %s\n", fn, strerror(errno)); return SANE_STATUS_ACCESS_DENIED; } @@ -215,7 +215,7 @@ sanei_access_lock( const char *devicename, SANE_Word timeout ) #endif } -SANE_Status +SANE_Status sanei_access_unlock( const char *devicename ) { #ifdef ENABLE_LOCKING |