mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-05 00:50:21 +00:00
do error checking instead of segfaulting
Original commit message from CVS: do error checking instead of segfaulting
This commit is contained in:
parent
82d33969ed
commit
7ad9aa8526
3 changed files with 17 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2004-04-16 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
* testsuite/refcounting/mem.c: (vmsize):
|
||||||
|
do error checking
|
||||||
|
|
||||||
2004-04-16 Johan Dahlin <johan@gnome.org>
|
2004-04-16 Johan Dahlin <johan@gnome.org>
|
||||||
|
|
||||||
* docs/gst/gstreamer-sections.txt: Add gst_pad_call_chain_function
|
* docs/gst/gstreamer-sections.txt: Add gst_pad_call_chain_function
|
||||||
|
|
|
@ -13,7 +13,13 @@ vmsize ()
|
||||||
pid = getpid ();
|
pid = getpid ();
|
||||||
snprintf (filename, 17, "/proc/%d/stat", pid);
|
snprintf (filename, 17, "/proc/%d/stat", pid);
|
||||||
fd = open (filename, O_RDONLY);
|
fd = open (filename, O_RDONLY);
|
||||||
|
if (fd == -1) {
|
||||||
|
fprintf (stderr, "warning: could not open %s\n", filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
size = read (fd, buf, 240);
|
size = read (fd, buf, 240);
|
||||||
|
if (size == -1)
|
||||||
|
return -1;
|
||||||
ptr = buf;
|
ptr = buf;
|
||||||
for (i = 0; i < 22; i++)
|
for (i = 0; i < 22; i++)
|
||||||
ptr = (char *) strchr (ptr, ' ') + 1;
|
ptr = (char *) strchr (ptr, ' ') + 1;
|
||||||
|
|
|
@ -13,7 +13,13 @@ vmsize ()
|
||||||
pid = getpid ();
|
pid = getpid ();
|
||||||
snprintf (filename, 17, "/proc/%d/stat", pid);
|
snprintf (filename, 17, "/proc/%d/stat", pid);
|
||||||
fd = open (filename, O_RDONLY);
|
fd = open (filename, O_RDONLY);
|
||||||
|
if (fd == -1) {
|
||||||
|
fprintf (stderr, "warning: could not open %s\n", filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
size = read (fd, buf, 240);
|
size = read (fd, buf, 240);
|
||||||
|
if (size == -1)
|
||||||
|
return -1;
|
||||||
ptr = buf;
|
ptr = buf;
|
||||||
for (i = 0; i < 22; i++)
|
for (i = 0; i < 22; i++)
|
||||||
ptr = (char *) strchr (ptr, ' ') + 1;
|
ptr = (char *) strchr (ptr, ' ') + 1;
|
||||||
|
|
Loading…
Reference in a new issue