The Samba-Bugzilla – Attachment 3515 Details for
Bug 5534
CIFS Lists Root Mount Directory For All Subdirectories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
test program that renames open files
rename_test.c (text/plain), 847 bytes, created by
Jeff Layton
on 2008-08-30 05:48:00 UTC
(
hide
)
Description:
test program that renames open files
Filename:
MIME Type:
Creator:
Jeff Layton
Created:
2008-08-30 05:48:00 UTC
Size:
847 bytes
patch
obsolete
>#define _POSIX_C_SOURCE 200112L > >#include <unistd.h> >#include <limits.h> >#include <stdio.h> >#include <stdlib.h> >#include <sys/types.h> >#include <sys/stat.h> >#include <fcntl.h> >#include <string.h> > >int main(int argc, char* argv[]) { > if (argc < 2) { > fprintf(stderr, "usage: %s <filename>", argv[0]); > exit(EXIT_FAILURE); > } > > int fd = -1; > if ((fd = open(argv[1], O_WRONLY | O_CREAT, S_IRWXU)) < 0) { > perror("open"); > exit(EXIT_FAILURE); > } > > char* newname = malloc(strlen(argv[1]) + 3); > strcpy(newname, argv[1]); > strcat(newname, ".r"); > > int fd2 = -1; > if ((fd2 = open(newname, O_RDONLY | O_CREAT, S_IRWXU)) < 0) { > perror("open2"); > exit(EXIT_FAILURE); > } > > // close(fd2); > > if (rename(argv[1], newname) < 0) { > perror("rename"); > exit(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 5534
:
3515