Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f519c667
Commit
f519c667
authored
Jan 10, 1995
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added bufsize parameter to fdopen and popen
parent
d15057c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
Modules/posixmodule.c
Modules/posixmodule.c
+19
-10
No files found.
Modules/posixmodule.c
View file @
f519c667
...
@@ -868,16 +868,22 @@ posix_popen(self, args)
...
@@ -868,16 +868,22 @@ posix_popen(self, args)
object
*
self
;
object
*
self
;
object
*
args
;
object
*
args
;
{
{
char
*
name
,
*
mode
;
char
*
name
;
char
*
mode
=
"r"
;
int
bufsize
=
-
1
;
FILE
*
fp
;
FILE
*
fp
;
if
(
!
getargs
(
args
,
"(ss)"
,
&
name
,
&
mode
))
object
*
f
;
if
(
!
newgetargs
(
args
,
"s|si"
,
&
name
,
&
mode
,
&
bufsize
))
return
NULL
;
return
NULL
;
BGN_SAVE
BGN_SAVE
fp
=
popen
(
name
,
mode
);
fp
=
popen
(
name
,
mode
);
END_SAVE
END_SAVE
if
(
fp
==
NULL
)
if
(
fp
==
NULL
)
return
posix_error
();
return
posix_error
();
return
newopenfileobject
(
fp
,
name
,
mode
,
pclose
);
f
=
newopenfileobject
(
fp
,
name
,
mode
,
pclose
);
if
(
f
!=
NULL
)
setfilebufsize
(
f
,
bufsize
);
return
f
;
}
}
#ifdef HAVE_SETUID
#ifdef HAVE_SETUID
...
@@ -1272,18 +1278,21 @@ posix_fdopen(self, args)
...
@@ -1272,18 +1278,21 @@ posix_fdopen(self, args)
{
{
extern
int
fclose
PROTO
((
FILE
*
));
extern
int
fclose
PROTO
((
FILE
*
));
int
fd
;
int
fd
;
char
*
mode
;
char
*
mode
=
"r"
;
int
bufsize
=
-
1
;
FILE
*
fp
;
FILE
*
fp
;
if
(
!
getargs
(
args
,
"(is)"
,
&
fd
,
&
mode
))
object
*
f
;
if
(
!
newgetargs
(
args
,
"i|si"
,
&
fd
,
&
mode
,
&
bufsize
))
return
NULL
;
return
NULL
;
BGN_SAVE
BGN_SAVE
fp
=
fdopen
(
fd
,
mode
);
fp
=
fdopen
(
fd
,
mode
);
END_SAVE
END_SAVE
if
(
fp
==
NULL
)
if
(
fp
==
NULL
)
return
posix_error
();
return
posix_error
();
/* From now on, ignore SIGPIPE and let the error checking
f
=
newopenfileobject
(
fp
,
"(fdopen)"
,
mode
,
fclose
);
do the work. */
if
(
f
!=
NULL
)
return
newopenfileobject
(
fp
,
"(fdopen)"
,
mode
,
fclose
);
setfilebufsize
(
f
,
bufsize
);
return
f
;
}
}
static
object
*
static
object
*
...
@@ -1369,7 +1378,7 @@ static struct methodlist posix_methods[] = {
...
@@ -1369,7 +1378,7 @@ static struct methodlist posix_methods[] = {
{
"getuid"
,
posix_getuid
},
{
"getuid"
,
posix_getuid
},
{
"kill"
,
posix_kill
},
{
"kill"
,
posix_kill
},
#endif
/* !NT */
#endif
/* !NT */
{
"popen"
,
posix_popen
},
{
"popen"
,
posix_popen
,
1
},
#ifdef HAVE_SETUID
#ifdef HAVE_SETUID
{
"setuid"
,
posix_setuid
},
{
"setuid"
,
posix_setuid
},
#endif
/* HAVE_SETUID */
#endif
/* HAVE_SETUID */
...
@@ -1405,7 +1414,7 @@ static struct methodlist posix_methods[] = {
...
@@ -1405,7 +1414,7 @@ static struct methodlist posix_methods[] = {
{
"read"
,
posix_read
},
{
"read"
,
posix_read
},
{
"write"
,
posix_write
},
{
"write"
,
posix_write
},
{
"fstat"
,
posix_fstat
},
{
"fstat"
,
posix_fstat
},
{
"fdopen"
,
posix_fdopen
},
{
"fdopen"
,
posix_fdopen
,
1
},
{
"pipe"
,
posix_pipe
},
{
"pipe"
,
posix_pipe
},
{
NULL
,
NULL
}
/* Sentinel */
{
NULL
,
NULL
}
/* Sentinel */
};
};
...
...
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