mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 09:21:53 +00:00
Use standard setmntent to open file and remember to close it with endmntent! Try better guess to use system defines to get mttab path
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@39377 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fcd7cb0ae7
commit
d416ef9ab7
2 changed files with 17 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
2016-02-16 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Source/NSWorkspace.m (mountedLocalVolumePaths)
|
||||
Use standard setmntent to open file and remember to close it with endmntent! Try better guess to use system defines to get mttab path.
|
||||
|
||||
2016-02-13 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Source/NSWorkspace.m (unmountAndEjectDeviceAtPath:)
|
||||
|
|
|
@ -1815,7 +1815,7 @@ launchIdentifiers: (NSArray **)identifiers
|
|||
/* let's check if it is a local volume we may unmount */
|
||||
if (![[self mountedLocalVolumePaths] containsObject:path])
|
||||
{
|
||||
NSLog(@"unmountAndEjectDeviceAtPath: Path %@ not mounted");
|
||||
NSLog(@"unmountAndEjectDeviceAtPath: Path %@ not mounted", path);
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -1873,7 +1873,7 @@ launchIdentifiers: (NSArray **)identifiers
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Don't know how to eject on %@", systype);
|
||||
NSLog(@"Don't know how to eject");
|
||||
}
|
||||
if (task != nil)
|
||||
{
|
||||
|
@ -1998,13 +1998,18 @@ launchIdentifiers: (NSArray **)identifiers
|
|||
* FIXME We won't get here on Solaris at all because it defines the
|
||||
* mntent struct in sys/mnttab.h instead of sys/mntent.h.
|
||||
*/
|
||||
# ifndef MNTTAB
|
||||
# ifdef _PATH_MOUNTED
|
||||
# define MOUNTED_PATH _PATH_MOUNTED
|
||||
# elif defined(MOUNTED)
|
||||
# define MOUNTED_PATH MOUNTED
|
||||
# else
|
||||
# define MNTTAB "/etc/mtab"
|
||||
# warning "Mounted path file for you OS guessed to /etc/mtab";
|
||||
# endif
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
FILE *fptr = fopen(MNTTAB, "r");
|
||||
struct mntent *m;
|
||||
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
FILE *fptr = setmntent(MOUNTED_PATH, "r");
|
||||
struct mntent *m;
|
||||
|
||||
names = [NSMutableArray arrayWithCapacity: 8];
|
||||
while ((m = getmntent(fptr)) != 0)
|
||||
|
@ -2015,6 +2020,7 @@ launchIdentifiers: (NSArray **)identifiers
|
|||
length: strlen(m->MNT_MEMB)];
|
||||
[names addObject: path];
|
||||
}
|
||||
endmntent(fptr);
|
||||
#else
|
||||
/* we resort in parsing mtab manually and removing then reserved mount names
|
||||
defined in preferences GSReservedMountNames (SystemPreferences) */
|
||||
|
|
Loading…
Reference in a new issue