On Sat, Jul 01, 2006 at 02:31:12PM +0530, [EMAIL PROTECTED] wrote:
> I was trying to type "-l" but I mistyped it as (with a space):
> 
>   crontab - l
> 
> To my surprise, this deleted the crontab.  Bad!  Better argument
> checking is needed.

'crontab - foo' means to replace the current user crontab with the file
'foo'.  The bug here is that the bcrontab program ignores the fact that
'foo' doesn't exist, it should barf in this case.

The problem seems to be in the bglibs, this should fix it.

Index: iobuf/ibuf_openreadclose.c
===================================================================
--- iobuf/ibuf_openreadclose.c  (revision 692)
+++ iobuf/ibuf_openreadclose.c  (working copy)
@@ -8,7 +8,7 @@
   ibuf in;
   int r;
   if (!ibuf_open(&in, filename, 0))
-    return -1;
+    return 0;
   r = ibuf_readall(&in, out);
   ibuf_close(&in);
   return r;

Until bglibs is fixed, this should be a good workaround for the bcron
package:

Index: bcrontab.c
===================================================================
RCS file: /cvs/bcron/bcrontab.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 bcrontab.c
--- bcrontab.c  1 Apr 2005 17:24:35 -0000       1.1.1.1
+++ bcrontab.c  4 Jul 2006 13:23:30 -0000
@@ -109,7 +109,7 @@
 static int do_replace(const char* path)
 {
   static str file;
-  if (!ibuf_openreadclose(path, &file))
+  if (ibuf_openreadclose(path, &file) <= 0)
     die3sys(111, "Could not read '", path, "'");
   docmd('S', &file, 0);
   msg1("crontab saved successfully");

Regards, Gerrit.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to