Re: [AVFS] unrar support for urar module

Miklos Szeredi <[email protected]> Thu, 16 Feb 2006 11:59:27 +0100
Newsgroups gmane.comp.file-systems.avfs.user
Message-ID <[email protected]>
X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO 
	autolearn=no version=3.1.0-rc2
From: Mark <stopverf-irGDp5a2xbY/[email protected]>
To: [email protected]
Content-Type: multipart/mixed;
 boundary="------------090702080604000002000300"
X-ENEM-Information: Please contact enem bv for more information
X-ENEM-Mailscanner: Found to be clean
Subject: [AVFS] unrar support for urar module
Sender: [email protected]
Date: Mon, 13 Feb 2006 13:59:03 +0100
> I attached a patch to make the urar module try unrar if rar failes to 
> execute.
> 

Thanks.

Ralf, does this look OK to you too?

Miklos

> 
> --------------090702080604000002000300 Content-Type: text/plain;
> name="avfs-unrar.diff" Content-Transfer-Encoding: 7bit
> Content-Disposition: inline; filename="avfs-unrar.diff"
> 
> --- avfs/modules/urar.c	2006-02-13 11:09:25.000000000 +0100
> +++ avfs-urar/modules/urar.c	2006-02-13 11:15:41.000000000 +0100
> @@ -520,7 +520,6 @@
>      if(res < 0)
>          return res;
>  
> -    /* FIXME: if the program 'rar' doesn't exist, try 'unrar' */
>      prog[0] = "rar";
>      prog[1] = "p";
>      prog[2] = "-c-";
> @@ -541,6 +540,23 @@
>      if(res == 0)
>          res = av_wait_prog(&pri, 0, 0);
>  
> +    if(res == -EIO)
> +    {
> +        // rar failed, Try unrar
> +        prog[0] = "unrar";
> +        av_init_proginfo(&pri);
> +        pri.prog = prog;
> +        pri.ifd = open("/dev/null", O_RDONLY);
> +        pri.ofd = fd;
> +        pri.efd = pri.ifd;
> +
> +        res = av_start_prog(&pri);
> +        close(pri.ifd);
> +
> +        if(res == 0)
> +            res = av_wait_prog(&pri, 0, 0);
> +    }
> +
>      av_unref_obj(rf);
>  
>      return res;
> 
> --------------090702080604000002000300--
> 


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642