Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 712767 Details for
Bug 754235
mgetty is missing a lockdev support and that can cause conflicts with minicom or any other software that uses lockdev for locking
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
mgetty: use liblockdev for device locking
mgetty-1.1.36-lockdev.patch (text/plain), 3.61 KB, created by
Michal Sekletar
on 2013-03-19 15:26:25 UTC
(
hide
)
Description:
mgetty: use liblockdev for device locking
Filename:
MIME Type:
Creator:
Michal Sekletar
Created:
2013-03-19 15:26:25 UTC
Size:
3.61 KB
patch
obsolete
>diff -up mgetty-1.1.36/locks.c.lockdev mgetty-1.1.36/locks.c >--- mgetty-1.1.36/locks.c.lockdev 2006-09-26 00:32:08.000000000 +0200 >+++ mgetty-1.1.36/locks.c 2013-03-19 13:10:35.740904148 +0100 >@@ -43,8 +43,16 @@ > #define LCK_OPNFAIL -2 > #endif > >+#ifdef HAVE_LOCKDEV >+#include <lockdev.h> >+#endif >+ > char lock[MAXLINE+1]; /* name of the lockfile */ > >+#ifdef HAVE_LOCKDEV >+static char lockdev_device[MAXLINE + 1]; >+#endif >+ > static int readlock _PROTO(( char * name )); > static char * get_lock_name _PROTO(( char * lock_name, char * device )); > static int lock_write_pid _PROTO(( int fd )); >@@ -58,8 +66,10 @@ static int we_have_lock = FALSE; > > int do_makelock _P0( void ) > { >+#ifndef HAVE_LOCKDEV > int fd, pid; > char *temp, buf[MAXLINE+1]; >+ > #ifndef HAVE_MKSTEMP > int tries = 0; > #endif >@@ -148,8 +158,26 @@ again: > return(FAIL); > } > >- lprintf(L_NOISE, "lock made"); > (void) unlink(temp); >+#else >+ pid_t device_owner; >+ >+ device_owner = dev_lock(lockdev_device); >+ if (device_owner < 0) >+ { >+ lprintf(L_ERROR, "lock not made: dev_lock(%s) failed", lockdev_device); >+ return FAIL; >+ } >+ >+ if (device_owner > 0) >+ { >+ lprintf(L_MESG, "lock not made: lock file exists (pid=%d)", device_owner); >+ return FAIL; >+ } >+ >+#endif >+ >+ lprintf(L_NOISE, "lock made"); > we_have_lock = TRUE; > return(SUCCESS); > } >@@ -165,6 +193,8 @@ int makelock _P1( (device), > { > lprintf(L_NOISE, "makelock(%s) called", device); > >+ strncpy(lockdev_device, device, MAXLINE); >+ > if ( get_lock_name( lock, device ) == NULL ) > { > lprintf( L_ERROR, "cannot get lock name" ); >@@ -180,10 +210,13 @@ int makelock _P1( (device), > */ > int steal_lock _P2((device, pid), char * device, int pid ) > { >- int retcode, is_pid, fd; >- >+ int retcode = SUCCESS; >+ > lprintf(L_NOISE, "steal_lock(%s) called", device); > >+#ifndef HAVE_LOCKDEV >+ int is_pid, fd; >+ > if ( get_lock_name( lock, device ) == NULL ) > { > lprintf( L_ERROR, "cannot get lock name" ); >@@ -208,6 +241,13 @@ int steal_lock _P2((device, pid), char * > } > > retcode = lock_write_pid( fd ); >+#else >+ if (dev_relock(lockdev_device, pid) < 0) >+ { >+ lprintf( L_ERROR, "can't steal lock: dev_relock(%s, %d) failed", device, pid); >+ retcode = FAIL; >+ } >+#endif > > if ( retcode == SUCCESS ) we_have_lock = TRUE; > return retcode; >@@ -237,6 +277,7 @@ int makelock_file _P1( (file), char * fi > int checklock _P1( (device), char * device) > { > int pid; >+#ifndef HAVE_LOCKDEV > struct stat st; > char name[MAXLINE+1]; > >@@ -270,7 +311,21 @@ int checklock _P1( (device), char * devi > (void) unlink(name); > return NO_LOCK; > } >- >+#else >+ pid = dev_testlock(lockdev_device); >+ >+ if (pid < 0) >+ { >+ lprintf(L_ERROR, "checklock: can't check lockfile, dev_testlock(%s) failed", lockdev_device); >+ return NO_LOCK; >+ } >+ >+ if (pid == 0) >+ { >+ lprintf(L_MESG, "checklock: device not locked"); >+ return NO_LOCK; >+ } >+#endif > lprintf(L_NOISE, "lockfile found, pid=%d", pid ); > > return pid; >@@ -352,8 +407,13 @@ void rmlocks _P0(void) > if ( we_have_lock ) > { > lprintf( L_NOISE, "removing lock file" ); >+#ifndef HAVE_LOCKDEV > if ( unlink(lock) == -1 ) > lprintf( L_ERROR, "error removing lock file (huh?!)" ); >+#else >+ if (dev_unlock(lockdev_device, getpid()) < 0) >+ lprintf(L_ERROR, "error removing lock file, dev_unlock(%s) failed", lockdev_device); >+#endif > } > /* mark lock file as 'not set' */ > we_have_lock = FALSE;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
jcapik
: review+
Actions:
View
|
Diff
Attachments on
bug 754235
: 712767