All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Xenomai] [Xenomai-git] Jan Kiszka : sysregd: Unmount filesystems via fusermount
       [not found] <E1Y89RI-000705-G1@sd-51317.xenomai.org>
@ 2015-01-06 10:03 ` Gilles Chanteperdrix
  2015-01-07  9:43   ` Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: Gilles Chanteperdrix @ 2015-01-06 10:03 UTC (permalink / raw)
  To: xenomai; +Cc: xenomai-git

On Mon, Jan 05, 2015 at 04:19:28PM +0100, git repository hosting wrote:
> +static void unmount(const char *path)
> +{
> +	const char cmd_tmpl[] = "/usr/bin/fusermount -uzq ";
> +	char *cmd = malloc(sizeof(cmd_tmpl) + strlen(path));
> +
> +	if (cmd) {
> +		strcpy(cmd, cmd_tmpl);
> +		strcat(cmd, path);
> +		system(cmd);
> +		free(cmd);
> +	}
> +}

That is really ugly. Why not using asprintf ?

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : sysregd: Unmount filesystems via fusermount
  2015-01-06 10:03 ` [Xenomai] [Xenomai-git] Jan Kiszka : sysregd: Unmount filesystems via fusermount Gilles Chanteperdrix
@ 2015-01-07  9:43   ` Jan Kiszka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2015-01-07  9:43 UTC (permalink / raw)
  To: Gilles Chanteperdrix, xenomai; +Cc: xenomai-git

On 2015-01-06 11:03, Gilles Chanteperdrix wrote:
> On Mon, Jan 05, 2015 at 04:19:28PM +0100, git repository hosting wrote:
>> +static void unmount(const char *path)
>> +{
>> +	const char cmd_tmpl[] = "/usr/bin/fusermount -uzq ";
>> +	char *cmd = malloc(sizeof(cmd_tmpl) + strlen(path));
>> +
>> +	if (cmd) {
>> +		strcpy(cmd, cmd_tmpl);
>> +		strcat(cmd, path);
>> +		system(cmd);
>> +		free(cmd);
>> +	}
>> +}
> 
> That is really ugly. Why not using asprintf ?

Good point. Wasn't fully aware of this function.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-07  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1Y89RI-000705-G1@sd-51317.xenomai.org>
2015-01-06 10:03 ` [Xenomai] [Xenomai-git] Jan Kiszka : sysregd: Unmount filesystems via fusermount Gilles Chanteperdrix
2015-01-07  9:43   ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.