Author: duncan
Date: Fri Sep 29 12:20:17 2006
New Revision: 8261
Modified:
branches/rel-1-5/freevo/freevo
Log:
[ 1567488 ] Misleading variable names
Patch applied.
Modified: branches/rel-1-5/freevo/freevo
==============================================================================
--- branches/rel-1-5/freevo/freevo (original)
+++ branches/rel-1-5/freevo/freevo Fri Sep 29 12:20:17 2006
@@ -187,10 +187,14 @@
'/tmp/' + name + '-%s.pid' % os.getuid()):
if os.path.isfile(fname):
f = open(fname)
- uid = int(f.readline()[:-1])
+ try:
+ pid = int(f.readline()[:-1])
+ except ValueError:
+ # file does not contain a number
+ return fname, 0
f.close()
- proc = '/proc/' + str(uid) + '/cmdline'
+ proc = '/proc/' + str(pid) + '/cmdline'
# FIXME: BSD support missing here
try:
if os.path.isfile(proc):
@@ -217,7 +221,7 @@
except OSError:
pass
return fname, 0
- return fname, uid
+ return fname, pid
return fname, 0
@@ -225,15 +229,15 @@
"""
stop running process 'name'
"""
- fname, uid = getpid(name, arg)
- if not uid:
+ fname, pid = getpid(name, arg)
+ if not pid:
return 0
try:
try:
os.unlink(fname)
except OSError:
pass
- os.kill(uid, SIGTERM)
+ os.kill(pid, SIGTERM)
return 1
except OSError:
return 0
@@ -244,24 +248,24 @@
"""
start a process
"""
- uid = os.fork()
- if uid:
+ pid = os.fork()
+ if pid:
if store:
try:
f = open('/var/run/' + name + '-%s.pid' % os.getuid(), 'w')
except (OSError, IOError):
f = open('/tmp/' + name + '-%s.pid' % os.getuid(), 'w')
- f.write(str(uid)+'\n')
+ f.write(str(pid)+'\n')
f.close()
if not bg:
try:
- os.waitpid(uid, 0)
+ os.waitpid(pid, 0)
except KeyboardInterrupt:
- os.kill(uid, SIGTERM)
+ os.kill(pid, SIGTERM)
try:
- os.waitpid(uid, 0)
+ os.waitpid(pid, 0)
except KeyboardInterrupt:
pass
if store and os.path.isfile(f.name):
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog