summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-03-27 17:22:31 (GMT)
committerGuido van Rossum <guido@python.org>1992-03-27 17:22:31 (GMT)
commit50e61dc2597ca5e3b5924feb2ab7d470c9c47da0 (patch)
tree3a04646fdcc4f311be33b3d5dac51979413cf0f3 /Modules/posixmodule.c
parent2762f250ebd42ed2f8b65cf9cd56bc65275c0b20 (diff)
downloadcpython-50e61dc2597ca5e3b5924feb2ab7d470c9c47da0.zip
cpython-50e61dc2597ca5e3b5924feb2ab7d470c9c47da0.tar.gz
cpython-50e61dc2597ca5e3b5924feb2ab7d470c9c47da0.tar.bz2
Check empty argument lists.
Lint fixes (and include <unistd.h>)
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 996ecdb..df4d888 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -57,6 +57,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#endif /* !SYSV */
+#ifndef NO_UNISTD
+#include <unistd.h> /* Take this out if it doesn't exist */
+#endif
+
#include "allobjects.h"
#include "modsupport.h"
@@ -397,6 +401,8 @@ posix_uname(self, args)
extern int uname PROTO((struct utsname *));
struct utsname u;
object *v;
+ if (!getnoarg(args))
+ return NULL;
if (uname(&u) < 0)
return posix_error();
v = newtupleobject(5);
@@ -526,6 +532,8 @@ posix_fork(self, args)
object *args;
{
int pid;
+ if (!getnoarg(args))
+ return NULL;
pid = fork();
if (pid == -1)
return posix_error();
@@ -549,7 +557,11 @@ posix_getpgrp(self, args)
{
if (!getnoarg(args))
return NULL;
+#ifdef SYSV
+ return newintobject((long)getpgrp());
+#else
return newintobject((long)getpgrp(0));
+#endif
}
static object *
@@ -657,7 +669,7 @@ posix_readlink(self, args)
int n;
if (!getstrarg(args, &path))
return NULL;
- n = readlink(path, buf, sizeof buf);
+ n = readlink(path, buf, (int) sizeof buf);
if (n < 0)
return posix_error();
return newsizedstringobject(buf, n);