~ubuntu-branches/ubuntu/oneiric/9base/oneiric

« back to all changes in this revision

Viewing changes to lib9/opentemp.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-08-20 17:34:06 UTC
  • mfrom: (6.2.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090820173406-xpwqa9ruyevvc0ut
Tags: 1:3-3
* Updating maintainer field.
* Updating vcs fields.
* Updating package to standards version 3.8.3.
* Updatin variables writing in rules to consistent style.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#include <libc.h>
3
3
 
4
4
int
5
 
opentemp(char *template)
 
5
opentemp(char *template, int mode)
6
6
{
7
 
        int fd;
 
7
        int fd, fd1;
8
8
 
9
9
        fd = mkstemp(template);
10
10
        if(fd < 0)
11
11
                return -1;
12
 
        remove(template);
13
 
        return fd;
 
12
        if((fd1 = open(template, mode)) < 0){
 
13
                remove(template);
 
14
                close(fd);
 
15
                return -1;
 
16
        }
 
17
        close(fd);
 
18
        return fd1;
14
19
}
15
20