Changeset 20984

Show
Ignore:
Timestamp:
05/02/07 15:05:57 (19 months ago)
Author:
korli
Message:

now creates the monitored directories if they don't exist (0755)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • haiku/trunk/src/servers/input/DeviceManager.cpp

    r20915 r20984  
    164164        BDirectory directory; 
    165165        BPath path("/dev"); 
    166         if (((err = path.Append(device)) != B_OK) 
    167                 || ((err = directory.SetTo(path.Path())) != B_OK)  
    168                 || ((err = directory.GetNodeRef(&nref)) != B_OK)) { 
    169                 PRINTERR(("DeviceManager::StartMonitoringDevice error %s: %s\n", path.Path(), strerror(err))); 
     166        if ((err = path.Append(device)) != B_OK) { 
     167                PRINTERR(("DeviceManager::StartMonitoringDevice BPath::Append() error %s: %s\n", path.Path(), strerror(err))); 
    170168                return err; 
    171169        } 
     170 
     171        if ((err = directory.SetTo(path.Path())) != B_OK) { 
     172                if (err != B_ENTRY_NOT_FOUND) { 
     173                        PRINTERR(("DeviceManager::StartMonitoringDevice SetTo error %s: %s\n", path.Path(), strerror(err))); 
     174                        return err; 
     175                } 
     176        if ((err = create_directory(path.Path(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) != B_OK 
     177                        || (err = directory.SetTo(path.Path())) != B_OK) { 
     178                        PRINTERR(("DeviceManager::StartMonitoringDevice CreateDirectory error %s: %s\n", path.Path(), strerror(err))); 
     179                        return err; 
     180                } 
     181        } 
     182 
     183        if ((err = directory.GetNodeRef(&nref)) != B_OK) { 
     184                PRINTERR(("DeviceManager::StartMonitoringDevice GetNodeRef error %s: %s\n", path.Path(), strerror(err))); 
     185                return err; 
     186        } 
     187         
    172188        // test if already monitored 
    173189        bool alreadyMonitored = false;