Skip site navigation (1)Skip section navigation (2)
Date:      11 Oct 2005 11:19:10 -0400
From:      Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
To:        David Marshall <dmarshall@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: mkstemp on NFS Mount?
Message-ID:  <44br1wxes1.fsf@be-well.ilk.org>
In-Reply-To: <53f158630510101240n50677077l5f0cb9abd66002a1@mail.gmail.com>
References:  <53f158630510101240n50677077l5f0cb9abd66002a1@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
David Marshall <dmarshall@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);
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44br1wxes1.fsf>