]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/mgetty/mgetty-1.1.30/40-locks.c_bug153394
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / mgetty / mgetty-1.1.30 / 40-locks.c_bug153394
1 --- mgetty-1.1.28.old/locks.c   2001-01-06 12:46:34.000000000 -0500
2 +++ mgetty-1.1.28/locks.c       2002-08-03 16:25:02.000000000 -0400
3 @@ -394,9 +394,42 @@
4  
5  #else  /* not SVR4 */ 
6  
7 +static char * unslash_name _P1 ( (device),
8 +                                char *device )
9 +{
10 +    char *lock_device, *ldev_begin, *ldevice_orig;
11 +
12 +    ldevice_orig = malloc( strlen (device) + 1 );
13 +    sprintf( ldevice_orig, "%s", device );
14 +
15 +    lock_device = strchr( ldevice_orig, '/' );
16 +    while (lock_device)
17 +      {
18 +       *lock_device = '_';
19 +       lock_device = strchr( lock_device, '/' );
20 +      }
21 +
22 +    if ( *ldevice_orig == '_' )
23 +      {
24 +       lock_device = strchr( ldevice_orig + 1, '_' );
25 +       if (! lock_device)
26 +         lock_device = ldevice_orig;
27 +       lock_device++;
28 +      }
29 +    else
30 +      lock_device = ldevice_orig;
31 +
32 +    ldev_begin = malloc( strlen( lock_device ) + 1 );
33 +    sprintf( ldev_begin, "%s", lock_device );
34 +    free( ldevice_orig );
35 +
36 +    return ldev_begin;
37 +}
38 +
39  static char * get_lock_name _P2( (lock_name, device),
40                           char * lock_name, char * device )
41  {
42 +    char *lock;
43  #ifdef LOCKS_LOWERCASE
44      /* sco locking convention -> change all device names to lowercase */
45  
46 @@ -425,10 +458,10 @@
47  #endif /* LOCKS_LOWERCASE */
48  
49      /* throw out all directory prefixes */
50 -    if ( strchr( device, '/' ) != NULL )
51 -        device = strrchr( device, '/' ) +1;
52 -    
53 -    sprintf( lock_name, LOCK, device);
54 +
55 +    lock = unslash_name ( device );
56 +    sprintf( lock_name, LOCK, lock );
57 +    free ( lock );
58  
59      return lock_name;
60  }