From ce539af98deefc6bc72848cfc0fc0fa82d6c8cb4 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Mon, 14 May 2012 23:18:11 -0500 Subject: verify -j input, and redo way of getting pkg name to allow for incorrect versions in info files, and because the new way is much more accurate. --- sboconfig | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'sboconfig') diff --git a/sboconfig b/sboconfig index af5de7a..583c449 100755 --- a/sboconfig +++ b/sboconfig @@ -70,19 +70,16 @@ my %changes; while (my ($key,$value) = each %valid_confs) { $changes{$value} = $options{$key} if exists $options{$key}; } +if (exists $changes{JOBS}) { + unless ($changes{JOBS} =~ /^\d+$/) { + print "You have provided an invalid parameter for -j\n"; + exit 1; + } +} my $conf_dir = $SBO::Lib::conf_dir;; my $conf_file = $SBO::Lib::conf_file; -sub make_temp_file { - make_path ('/tmp/sbotools') unless -d '/tmp/sbotools'; - my $temp_dir = -d '/tmp/sbotools' ? '/tmp/sbotools' : $ENV{TMPDIR} || - $ENV{TEMP}; - my $filename = sprintf "%s/%d-%d-0000", $temp_dir, $$, time; - sysopen my ($fh), $filename, O_WRONLY|O_EXCL|O_CREAT; - return ($fh,$filename); -} - sub config_write { script_error ('config_write requires two arguments.') unless exists $_[1]; my ($key,$val) = @_; @@ -91,7 +88,7 @@ sub config_write { or print "Unable to create $conf_dir. Exiting.\n" and exit (1); } if (-f $conf_file) { - my ($fh,$filename) = make_temp_file(); + my ($fh,$filename) = make_temp_file (); open my $reader, '<', $conf_file; print {$fh} <$reader>; close ($fh); -- cgit v1.2.3