Lines 34-39
Link Here
|
34 |
#include <sys/stat.h> |
34 |
#include <sys/stat.h> |
35 |
#include <unistd.h> |
35 |
#include <unistd.h> |
36 |
#include <stdio.h> |
36 |
#include <stdio.h> |
|
|
37 |
#include <mntent.h> |
37 |
/*}}}*/ |
38 |
/*}}}*/ |
38 |
|
39 |
|
39 |
// IsMounted - Returns true if the mount point is mounted /*{{{*/ |
40 |
// IsMounted - Returns true if the mount point is mounted /*{{{*/ |
Lines 100-105
bool UnmountCdrom(string Path)
Link Here
|
100 |
} |
101 |
} |
101 |
else |
102 |
else |
102 |
{ |
103 |
{ |
|
|
104 |
FILE *f; |
105 |
if ((f = setmntent ("/proc/mounts", "r")) != NULL) |
106 |
{ |
107 |
struct mntent *mnt; |
108 |
while ((mnt = getmntent (f)) != NULL) |
109 |
{ |
110 |
string MntDir(mnt->mnt_dir); |
111 |
if (MntDir[MntDir.length() - 1] != '/') |
112 |
MntDir += '/'; |
113 |
if ( Path == MntDir ) |
114 |
if ((strcmp ("subfs", mnt->mnt_type) == 0) || (strcmp ("supermount", mnt->mnt_type) == 0)) |
115 |
_exit(0); |
116 |
} |
117 |
endmntent (f); |
118 |
} |
119 |
|
103 |
const char *Args[10]; |
120 |
const char *Args[10]; |
104 |
Args[0] = "umount"; |
121 |
Args[0] = "umount"; |
105 |
Args[1] = Path.c_str(); |
122 |
Args[1] = Path.c_str(); |