Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

using glib functions

nits123nits123 Member Posts: 2
Hi
I am using the glib function g_spawn_command_line_sync to spawn a new child process and a run a command.
Although everthing works fine in the begiining, i am getting errors elswhere in code for popen. Error like "popen: Cannot allocate memory".
This error came up only after starting using the glib function.
Can anyone let me know if i need to take care of anything else in code while using glib.
Pls see sample code:

ret = g_spawn_command_line_sync(cmd2,&tmp,&err,&exitstatus,NULL);
if(strlen(tmp) > 0)
{.........
.........
g_free(tmp);
}

if(strlen(err) > 0)
{
.....................
g_free(err);
}
if (WIFEXITED (exitstatus) != 0)
{
if (WEXITSTATUS (exitstatus) != 0)
{
......

}
}


Sign In or Register to comment.