~ubuntu-branches/ubuntu/vivid/ecryptfs-utils/vivid

« back to all changes in this revision

Viewing changes to src/testcases/zombie.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2007-11-16 12:10:00 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20071116121000-8ob8mqnq4btrafhx
Tags: 30-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <stdio.h>
2
 
#include <ecryptfs.h>
3
 
 
4
 
int main()
5
 
{
6
 
        int rc;
7
 
 
8
 
        if (fork() == 0) {
9
 
                printf("Setting placeholder\n");
10
 
                if ((rc = ecryptfs_set_zombie_session_placeholder())) {
11
 
                        printf("Error setting zombie placeholder; rc = [%d]\n", rc);
12
 
                        goto out;
13
 
                }
14
 
                exit(1);
15
 
        }
16
 
        sleep(5);
17
 
        printf("Listing placeholders\n");
18
 
        if ((rc = ecryptfs_list_zombie_session_placeholders())) {
19
 
                printf("Error listing zombie placeholders; rc = [%d]\n", rc);
20
 
                goto out;
21
 
        }
22
 
        sleep(1);
23
 
        printf("Killing and clearing placeholder\n");
24
 
        if ((rc = ecryptfs_kill_and_clear_zombie_session_placeholder())) {
25
 
                printf("Error killing and clearing zombie placeholder; "
26
 
                       "rc = [%d]\n", rc);
27
 
                goto out;
28
 
        }
29
 
        sleep(1);
30
 
        printf("Listing placeholder\n");
31
 
        if ((rc = ecryptfs_list_zombie_session_placeholders())) {
32
 
                printf("Error listing zombie placeholders; rc = [%d]\n", rc);
33
 
                goto out;
34
 
        }
35
 
out:
36
 
        return rc;
37
 
}