Fwd: quoting the arguments to cat in the system call

Kirk Bauer <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Any thoughts on this?  I'm surprised Samba doesn't remove spaces from
the filenames.

------------------------------------------------------
Kirk Bauer <[email protected]>
http://linux.kaybee.org | www.logwatch.org
Author, Automating UNIX & Linux Administration




---------- Forwarded message ----------
From: Brian W. Neu <[email protected]>
Date: Fri, Dec 18, 2009 at 6:11 AM
Subject: quoting the arguments to cat in the system call
To: [email protected]


Samba will generate file names based on either the username or the
machine name.  So I end up with log files named "/var/log/samba/jamie
smith.log" and then end up with

/etc/cron.daily/0logwatch:

cat: /var/log/samba/log.jamie: No such file or directory
cat: smith: No such file or directory

I don't know if this will work in all cases, but I've changed the following:


896c896
<             my $arguments = "\"$Archive\"  >> $DestFile";
---
>             my $arguments = "$Archive  >> $DestFile";
998,999c998,999
<          system("$Config{'pathtocat'} \"$eeefile\" $ecpcmd") == 0
<             or die "system $Config{'pathtocat'} \"$eeefile\" $ecpcmd
failed: $?"
---
>          system("$Config{'pathtocat'} $eeefile $ecpcmd") == 0
>             or die "system $Config{'pathtocat'} $eeefile $ecpcmd failed: $?"
1195c1195
<             $Command = " ( $Config{'pathtocat'} \"$FileText\" |
$HostStrip | $FilterText) 2>&1 ";
---
>             $Command = " ( $Config{'pathtocat'} $FileText | $HostStrip | $FilterText) 2>&1 ";
1197c1197
<             $Command = " ( $Config{'pathtocat'} \"$FileText\" |
$FilterText) 2>&1 ";
---
>             $Command = " ( $Config{'pathtocat'} $FileText | $FilterText) 2>&1 ";







--
Brian W. Neu
Principal
Advanced Open Systems, Inc.
Technology Applied for Business
404.452.0043 (v)
404.418.6911 (f)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.