Re: URL handling broken?
- From: Ali Akcaagac <ali akcaagac stud fh-wilhelmshaven de>
- To: Toralf Lund <toralf kscanners com>
- Cc: Ali Akcaagac <ali akcaagac stud fh-wilhelmshaven de>,Toralf Lund <toralf kscanners com>,Balsa Mailing List <balsa-list gnome org>
- Subject: Re: URL handling broken?
- Date: Thu, 16 Aug 2001 13:30:44 +0200
On 2001.08.16 13:16:07 +0200 Toralf Lund wrote:
> --- src/balsa-message.c 2001/08/10 13:40:52 1.174
> +++ src/balsa-message.c 2001/08/16 12:06:52
> @@ -2019,7 +2019,7 @@
> gchar *exe_str, *cps = g_strdup(cmd);
> cps[fpos - cmd + 1] = 's';
> exe_str = g_strdup_printf(cps, info->body->temp_filename);
> - gnome_execute_shell(NULL, exe_str);
> + system(exe_str);
> fprintf(stderr, "Executed: %s\n", exe_str);
> g_free (cps);
> g_free (exe_str);
no, its not the right way, never execute system, if theres an
substitute for gnome. if you want to use system, then you need
to fork things correcty, save the pid and leave the system
call with _exit as shown in this example:
;------------------------------------------------------------
pid_t pid = 0;
if((pid = fork()) == -1) {
fprintf(stderr, "Launcher: Can't fork.\n");
}
else {
if(pid == 0) {
system(buffer3);
_exit(0);
}
else {
waitpid(pid, NULL, 0);
}
}
;------------------------------------------------------------
buffer3 in this case is a char[] array.
i want also to comment, that not every system has the system
call implemented as on linux, it varies on several systems,
some systems dont have the fork function they need to use the
substitute vfork etc... so be warned whenever playing with
straight glibc functions.
--
Name....: Ali Akcaagac
Status..: Student Of Computer & Economic Science
E-Mail..: mailto:ali.akcaagac@stud.fh-wilhelmshaven.de
WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]