The Samba-Bugzilla – Attachment 2862 Details for
Bug 4876
can lock file, but cannot unlock it.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Basic file locking test
locktest.c (text/x-csrc), 856 bytes, created by
yuval aviel
on 2007-08-12 03:46:01 UTC
(
hide
)
Description:
Basic file locking test
Filename:
MIME Type:
Creator:
yuval aviel
Created:
2007-08-12 03:46:01 UTC
Size:
856 bytes
patch
obsolete
>#define _LARGEFILE64_SOURCE > >#include <stdio.h> >#include <stdlib.h> >#include <unistd.h> >#include <fcntl.h> > >int main (int argc, char *argv[]) >{ > int fd; > struct flock lock; > > if (argc != 2) > { > printf ("usage: %s <filename>\n", argv[0]); > return EXIT_FAILURE; > } > > fd = open(argv[1], O_WRONLY|O_CREAT|O_LARGEFILE, 0666); > if (fd < 0) > { > printf("Couldn't open '%s'\n", argv[1]); > return EXIT_FAILURE; > } > lock.l_type = F_WRLCK; > lock.l_whence = SEEK_SET; > lock.l_start = 0; > lock.l_len = 0; > if (fcntl(fd, F_SETLK, &lock) < 0) > { > printf("Couldn't lock file\n"); > return EXIT_FAILURE; > } > lock.l_type = F_UNLCK; > if (fcntl(fd, F_SETLKW, &lock) < 0) > { > printf("Couldn't lock file\n"); > return EXIT_FAILURE; > } > > return EXIT_SUCCESS; >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 4876
: 2862