1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

build: Remove sys_open wrapper

This commit is contained in:
Andrew Bartlett 2012-03-28 12:48:00 +11:00
parent 9cc056e567
commit d166b79852
16 changed files with 24 additions and 34 deletions

View File

@ -85,7 +85,7 @@ _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout
if (!no_process_group) setsid();
#elif defined(TIOCNOTTY)
if (!no_process_group) {
int i = sys_open("/dev/tty", O_RDWR, 0);
int i = open("/dev/tty", O_RDWR, 0);
if (i != -1) {
ioctl(i, (int) TIOCNOTTY, (char *)0);
close(i);

View File

@ -1108,7 +1108,7 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
handle = fileno(stdout);
} else {
if (reget) {
handle = sys_open(lname, O_WRONLY|O_CREAT, 0644);
handle = open(lname, O_WRONLY|O_CREAT, 0644);
if (handle >= 0) {
start = lseek(handle, 0, SEEK_END);
if (start == -1) {
@ -1117,7 +1117,7 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
}
}
} else {
handle = sys_open(lname, O_WRONLY|O_CREAT|O_TRUNC, 0644);
handle = open(lname, O_WRONLY|O_CREAT|O_TRUNC, 0644);
}
newhandle = true;
}

View File

@ -336,7 +336,6 @@ int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
bool fake_dir_create_times);
int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len);
int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len);
int sys_open(const char *path, int oflag, mode_t mode);
FILE *sys_fopen(const char *path, const char *type);
void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
SMB_STRUCT_DIR *sys_opendir(const char *name);

View File

@ -66,7 +66,7 @@ pid_t pidfile_pid(const char *program_name)
SAFE_FREE(name);
fd = sys_open(pidFile, O_NONBLOCK | O_RDONLY, 0644);
fd = open(pidFile, O_NONBLOCK | O_RDONLY, 0644);
if (fd == -1) {
SAFE_FREE(pidFile);
return 0;
@ -147,7 +147,7 @@ void pidfile_create(const char *program_name)
exit(1);
}
fd = sys_open(pidFile_name, O_NONBLOCK | O_CREAT | O_WRONLY | O_EXCL,
fd = open(pidFile_name, O_NONBLOCK | O_CREAT | O_WRONLY | O_EXCL,
0644);
if (fd == -1) {
DEBUG(0,("ERROR: can't open %s: Error was %s\n", pidFile_name,

View File

@ -375,7 +375,7 @@ static void get_password_file(struct user_auth_info *auth_info)
sscanf(p, "%d", &fd);
close_it = false;
} else if ((p = getenv("PASSWD_FILE")) != NULL) {
fd = sys_open(p, O_RDONLY, 0);
fd = open(p, O_RDONLY, 0);
spec = SMB_STRDUP(p);
if (fd < 0) {
fprintf(stderr, "Error opening PASSWD_FILE %s: %s\n",

View File

@ -584,15 +584,6 @@ int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OF
#endif
}
/*******************************************************************
An open() wrapper.
********************************************************************/
int sys_open(const char *path, int oflag, mode_t mode)
{
return open(path, oflag, mode);
}
/*******************************************************************
An fopen() wrapper.
********************************************************************/

View File

@ -55,7 +55,7 @@ NTSTATUS gpo_copy_file(TALLOC_CTX *mem_ctx,
goto out;
}
if ((fd = sys_open(unix_path, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1) {
if ((fd = open(unix_path, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1) {
result = map_nt_error_from_unix(errno);
goto out;
}

View File

@ -70,16 +70,16 @@ static int copy_reg(const char *source, const char *dest)
return -1;
}
if((ifd = sys_open (source, O_RDONLY, 0)) < 0)
if((ifd = open (source, O_RDONLY, 0)) < 0)
return -1;
if (unlink (dest) && errno != ENOENT)
return -1;
#ifdef O_NOFOLLOW
if((ofd = sys_open (dest, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, 0600)) < 0 )
if((ofd = open (dest, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, 0600)) < 0 )
#else
if((ofd = sys_open (dest, O_WRONLY | O_CREAT | O_TRUNC , 0600)) < 0 )
if((ofd = open (dest, O_WRONLY | O_CREAT | O_TRUNC , 0600)) < 0 )
#endif
goto err;

View File

@ -481,7 +481,7 @@ static int vfswrap_open(vfs_handle_struct *handle,
goto out;
}
result = sys_open(smb_fname->base_name, flags, mode);
result = open(smb_fname->base_name, flags, mode);
out:
END_PROFILE(syscall_open);
return result;

View File

@ -8520,9 +8520,9 @@ static int process_usershare_file(const char *dir_name, const char *file_name, i
/* Try and open the file read only - no symlinks allowed. */
#ifdef O_NOFOLLOW
fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
fd = open(fname, O_RDONLY|O_NOFOLLOW, 0);
#else
fd = sys_open(fname, O_RDONLY, 0);
fd = open(fname, O_RDONLY, 0);
#endif
if (fd == -1) {

View File

@ -214,7 +214,7 @@ static FILE *startsmbfilepwent(const char *pfile, enum pwf_access_type type, int
int i, fd = -1;
for(i = 0; i < 5; i++) {
if((fd = sys_open(pfile, O_CREAT|O_TRUNC|O_EXCL|O_RDWR, 0600))!=-1) {
if((fd = open(pfile, O_CREAT|O_TRUNC|O_EXCL|O_RDWR, 0600))!=-1) {
break;
}
usleep(200); /* Spin, spin... */

View File

@ -74,7 +74,7 @@ static int findpty(char **slave)
#if defined(HAVE_GRANTPT)
/* Try to open /dev/ptmx. If that fails, fall through to old method. */
if ((master = sys_open("/dev/ptmx", O_RDWR, 0)) >= 0) {
if ((master = open("/dev/ptmx", O_RDWR, 0)) >= 0) {
grantpt(master);
unlockpt(master);
line = (char *)ptsname(master);
@ -114,7 +114,7 @@ static int findpty(char **slave)
line));
line[8] = dpname[3];
line[9] = dpname[4];
if ((master = sys_open(line, O_RDWR, 0)) >= 0) {
if ((master = open(line, O_RDWR, 0)) >= 0) {
DEBUG(3, ("pty: opened %s\n", line));
line[5] = 't';
*slave = line;
@ -158,7 +158,7 @@ static int dochild(int master, const char *slavedev, const struct passwd *pass,
}
/* Open slave pty and acquire as new controlling terminal. */
if ((slave = sys_open(slavedev, O_RDWR, 0)) < 0)
if ((slave = open(slavedev, O_RDWR, 0)) < 0)
{
DEBUG(3, ("More weirdness, could not open %s\n", slavedev));
return (False);

View File

@ -64,7 +64,7 @@ static bool irix_oplocks_available(void)
return False;
}
if((fd = sys_open(tmpname, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600)) < 0) {
if((fd = open(tmpname, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600)) < 0) {
DEBUG(0,("check_kernel_oplocks: Unable to open temp test file "
"%s. Error was %s\n",
tmpname, strerror(errno) ));

View File

@ -876,7 +876,7 @@ bool disk_quotas(const char *path,
}
DEBUG(5,("disk_quotas: looking for quotas file \"%s\"\n", name));
if((file=sys_open(name, O_RDONLY,0))<0) {
if((file=open(name, O_RDONLY,0))<0) {
unbecome_root();
return false;
}
@ -1585,7 +1585,7 @@ bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *d
set_effective_uid(0);
DEBUG(5,("disk_quotas: looking for VxFS quotas file \"%s\"\n", qfname));
if((file=sys_open(qfname, O_RDONLY,0))<0) {
if((file=open(qfname, O_RDONLY,0))<0) {
set_effective_uid(euser_id);
return(False);
}

View File

@ -359,9 +359,9 @@ static int info_fn(struct file_list *fl, void *priv)
}
#ifdef O_NOFOLLOW
fd = sys_open(basepath, O_RDONLY|O_NOFOLLOW, 0);
fd = open(basepath, O_RDONLY|O_NOFOLLOW, 0);
#else
fd = sys_open(basepath, O_RDONLY, 0);
fd = open(basepath, O_RDONLY, 0);
#endif
if (fd == -1) {

View File

@ -34,7 +34,7 @@ int web_open(const char *fname, int flags, mode_t mode)
int fd;
if (lang) {
if (asprintf(&p, "lang/%s/%s", lang, fname) != -1) {
fd = sys_open(p, flags, mode);
fd = open(p, flags, mode);
free(p);
if (fd != -1) {
return fd;
@ -43,7 +43,7 @@ int web_open(const char *fname, int flags, mode_t mode)
}
/* fall through to default name */
return sys_open(fname, flags, mode);
return open(fname, flags, mode);
}