Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kasra Jamshidi
slapos.package
Commits
76aca390
Commit
76aca390
authored
May 28, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duplicate mapped drive (same share folder or subfolder).
parent
6656d35b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
2 deletions
+46
-2
windows/netreport/src/netuse.c
windows/netreport/src/netuse.c
+46
-2
No files found.
windows/netreport/src/netuse.c
View file @
76aca390
...
...
@@ -138,6 +138,41 @@ netuse_map_drive(PyObject *self, PyObject *args)
return
NULL
;
}
static
int
check_duplicate_shared_folder
(
PyObject
*
retvalue
,
const
char
*
folder
)
{
if
(
!
PyList_Check
(
retvalue
))
return
-
1
;
Py_ssize_t
size
=
PyList_Size
(
retvalue
);
int
len
=
strlen
(
folder
);
int
len2
;
PyObject
*
item
;
char
*
s
;
while
(
size
)
{
size
--
;
item
=
PySequence_GetItem
(
retvalue
,
size
);
if
(
!
PySequence_Check
(
item
))
return
-
1
;
s
=
PyString_AsString
(
PySequence_GetItem
(
item
,
1
));
if
(
s
==
NULL
)
return
-
1
;
len2
=
strlen
(
s
);
if
(
strncmp
(
folder
,
s
,
len
>
len2
?
len
:
len2
)
==
0
)
{
if
(
len2
>
len
)
{
if
(
PySequence_DelItem
(
retvalue
,
size
)
==
-
1
)
return
-
1
;
size
--
;
}
else
return
1
;
}
}
return
0
;
}
static
PyObject
*
netuse_usage_report
(
PyObject
*
self
,
PyObject
*
args
)
{
...
...
@@ -226,7 +261,17 @@ netuse_usage_report(PyObject *self, PyObject *args)
Py_XDECREF
(
retvalue
);
return
NULL
;
}
switch
(
check_duplicate_shared_folder
(
retvalue
,
szRemoteName
))
{
case
-
1
:
Py_XDECREF
(
retvalue
);
return
NULL
;
case
1
:
continue
;
default:
break
;
}
if
(
GetDiskFreeSpaceEx
(
drivepath
,
&
lFreeBytesAvailable
,
&
lTotalNumberOfBytes
,
...
...
@@ -254,7 +299,6 @@ netuse_usage_report(PyObject *self, PyObject *args)
return
NULL
;
}
}
return
retvalue
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment