[Thread Prev][Thread Next][Index]

Re: hack to run ferret on RO FS. (Was Re: Ferret open .jnl file rw ?)



Hi,
I really would like to have access to ferret source code to try to handle the EROFS error corectly. Ferret sources are not avialable at http://ferret.pmel.noaa.gov/Ferret/Downloads/linux_downloads.html and I have no more mail adresses than contact_ferret@pmel.noaa.gov and ferret_users@ferret.wrc.noaa.gov.

Can someone tell me someone to contact to send me the source so I can patch it ?

--
Olivier


Olivier Archer wrote:
Hi,
I've *temporary* solved my problem, with a so ugly hack:
I've overload the fopen libc function to set errno whith EACCES when it is EROFS...

#include <stdlib.h>
#include <dlfcn.h>
#include <signal.h>
#include <errno.h>


FILE *fopen(const char *path, const char *mode){
static FILE *(*RealFopen)(const char *path, const char *mode)=0;
FILE *fid;


// set it up only once
if (!RealFopen){
RealFopen=dlsym(((void *) -1l), "fopen");
if (!RealFopen){
fprintf(stderr, "Fatal error - cannot find fopen()\n");
abort();
}
}

fid= RealFopen(path,mode);
/* force errno to be EACCES if it is EROFS */
if( (fid == NULL) && ( errno == EROFS ) ){ errno=EACCES; }
return fid;
}

%gcc -o fopen.so -shared fopen.c
%setenv LD_PRELOAD fopen.so
%ferret

This hack permit me go ahead with LAS, but I think something is doable source side...





[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement