mkstemp on NFS Mount?

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Tue Oct 11 08:19:13 PDT 2005


David Marshall <dmarshall at gmail.com> writes:

> I've read mixed opinions on whether it's feasible to be doing msktemp
> on an NFS-mounted filesystem.  Is it possible to do this?
> 
> I use File::Temp to use mkstemp, but it's all the same, I get error
> messages such as:
> 
> Error in tempfile() using /mnt/.XXXXX: Could not create temp file
> /mnt/.hkATa: Operation not supported at (eval
> 14)[/usr/local/lib/perl5/5.8.7/perl5db.pl:628] line 2
> 
> Is this a matter of not having certain permissions set properly?

Probably not; no way to say without seeing your code.

In C, I get no errors at all on a quick test program (at bottom of
message).  I tried it on both NFS and non-NFS filesystems.  I don't
know what problems you were referring to.

================================================================

#include <stdio.h>
#include <unistd.h>
#include <errno.h>

int main(void)
{
    char pattern[100] = "foo.bar.XXXX";
    char text[] = "hello world\n";
    int i,j;

    i = mkstemp(pattern);
    printf("pattern now %s\n",pattern);

    j = write(i,text,sizeof(text));
    if (sizeof(text) != j)
      printf("write() wrote wrong length %d\n");

    j = close(i);
    if (j != 0)
      printf("close() returned error; errno is %d\n",errno);
}


More information about the freebsd-questions mailing list