~ubuntu-branches/ubuntu/precise/nfs-utils/precise-proposed

« back to all changes in this revision

Viewing changes to utils/lockd/lockd.c

  • Committer: Bazaar Package Importer
  • Author(s): Nathaniel McCallum
  • Date: 2004-09-10 13:10:39 UTC
  • Revision ID: james.westby@ubuntu.com-20040910131039-qxfjx4pwgoz6imbv
Tags: upstream-1.0.6
ImportĀ upstreamĀ versionĀ 1.0.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * lockd
 
3
 *
 
4
 * This is the user level part of lockd. This is very primitive, because
 
5
 * all the work is now done in the kernel module.
 
6
 *
 
7
 */
 
8
 
 
9
#include "config.h"
 
10
 
 
11
#include <stdio.h>
 
12
#include <unistd.h>
 
13
#include <string.h>
 
14
#include <errno.h>
 
15
#include "nfslib.h"
 
16
 
 
17
static void     usage(const char *);
 
18
 
 
19
int
 
20
main(int argc, char **argv)
 
21
{
 
22
        int error;
 
23
 
 
24
        if (argc > 1)
 
25
                usage (argv [0]);
 
26
 
 
27
        if (chdir(NFS_STATEDIR)) {
 
28
                fprintf(stderr, "%s: chdir(%s) failed: %s\n",
 
29
                        argv [0], NFS_STATEDIR, strerror(errno));
 
30
                exit(1);
 
31
        }
 
32
 
 
33
        if ((error = lockdsvc()) < 0) {
 
34
                if (errno == EINVAL)
 
35
                        /* Ignore EINVAL since kernel may start
 
36
                           lockd automatically. */
 
37
                        error = 0;
 
38
                else
 
39
                        perror("lockdsvc");
 
40
        }
 
41
 
 
42
        return (error != 0);
 
43
}
 
44
 
 
45
static void
 
46
usage(const char *prog)
 
47
{
 
48
        fprintf(stderr, "usage:\n%s\n", prog);
 
49
        exit(2);
 
50
}