~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to tests/kernel/miscdev-bad-count/test.c

  • Committer: Dustin Kirkland
  • Date: 2009-02-13 15:57:24 UTC
  • Revision ID: kirkland@canonical.com-20090213155724-1q3qz2o0cbyimu9x
debian/ubuntu packaging

Initial checkin of the Debian/Ubuntu packaging

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/**
3
 
 * test.c: C-based test for https://lkml.org/lkml/2012/1/11/394
4
 
 * Author: Tyler Hicks <tyhicks@canonical.com>
5
 
 *
6
 
 * Copyright (C) 2012 Canonical, Ltd.
7
 
 *
8
 
 * This program is free software; you can redistribute it and/or
9
 
 * modify it under the terms of the GNU General Public License
10
 
 * as published by the Free Software Foundation; either version 2
11
 
 * of the License, or (at your option) any later version.
12
 
 *
13
 
 * This program is distributed in the hope that it will be useful,
14
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
 * GNU General Public License for more details.
17
 
 *
18
 
 * You should have received a copy of the GNU General Public License
19
 
 * along with this program; if not, write to the Free Software
20
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
 
 * 02110-1301, USA
22
 
 */
23
 
 
24
 
#include <sys/types.h>
25
 
#include <sys/stat.h>
26
 
#include <fcntl.h>
27
 
#include <unistd.h>
28
 
 
29
 
int main(void)
30
 
{
31
 
        unsigned char buf[] = { 103, 0, 0, 0, 0, 220 };
32
 
        ssize_t written;
33
 
        int miscdev;
34
 
 
35
 
       
36
 
        miscdev = open("/dev/ecryptfs", O_WRONLY);
37
 
        if (miscdev < 0)
38
 
                return 1;
39
 
 
40
 
        written = write(miscdev, buf, 1073741824);
41
 
 
42
 
        close(miscdev);
43
 
 
44
 
        /* The write should fail */
45
 
        return written < 0 ? 0 : 2;
46
 
}