From: Andrew Bartlett Date: Wed, 28 Mar 2012 01:48:00 +0000 (+1100) Subject: build: Remove sys_open wrapper X-Git-Tag: samba-4.0.0alpha19~65 X-Git-Url: http://git.samba.org/samba.git/?p=sfrench%2Fsamba-autobuild%2F.git;a=commitdiff_plain;h=d166b798529dab4538054d0b68797c0cc17f34de build: Remove sys_open wrapper --- diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c index 92a75862bdd..373927ca6ea 100644 --- a/lib/util/become_daemon.c +++ b/lib/util/become_daemon.c @@ -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); diff --git a/source3/client/client.c b/source3/client/client.c index f10e56348c7..95500b08621 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -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; } diff --git a/source3/include/proto.h b/source3/include/proto.h index 6af0a044e67..e603d0d839c 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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); diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 469ddbd95fd..f1c89ebaf35 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -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, diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c index 0c8f691c255..3bcee1c8d7f 100644 --- a/source3/lib/popt_common.c +++ b/source3/lib/popt_common.c @@ -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", diff --git a/source3/lib/system.c b/source3/lib/system.c index b12def59298..f22215d2a18 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -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. ********************************************************************/ diff --git a/source3/libgpo/gpo_filesync.c b/source3/libgpo/gpo_filesync.c index 7f0e4107d6c..6e3efdaf6c1 100644 --- a/source3/libgpo/gpo_filesync.c +++ b/source3/libgpo/gpo_filesync.c @@ -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; } diff --git a/source3/modules/vfs_crossrename.c b/source3/modules/vfs_crossrename.c index a54125c3269..a38ae45948a 100644 --- a/source3/modules/vfs_crossrename.c +++ b/source3/modules/vfs_crossrename.c @@ -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; diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 35073143c06..615c0296b46 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -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; diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index f4e01335c5f..d48ee795e84 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -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) { diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index 71b21fbb28f..7f82c1f7cd7 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -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... */ diff --git a/source3/rpc_server/samr/srv_samr_chgpasswd.c b/source3/rpc_server/samr/srv_samr_chgpasswd.c index 1e8b14ead7f..b083fb94bf7 100644 --- a/source3/rpc_server/samr/srv_samr_chgpasswd.c +++ b/source3/rpc_server/samr/srv_samr_chgpasswd.c @@ -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); diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 2097945b975..aa987fccbb8 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -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) )); diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c index 41516621f0f..c2616157e43 100644 --- a/source3/smbd/quotas.c +++ b/source3/smbd/quotas.c @@ -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); } diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c index 295f9ce4d9b..8f77f739947 100644 --- a/source3/utils/net_usershare.c +++ b/source3/utils/net_usershare.c @@ -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) { diff --git a/source3/web/neg_lang.c b/source3/web/neg_lang.c index 59475d12b57..09eff7ea08c 100644 --- a/source3/web/neg_lang.c +++ b/source3/web/neg_lang.c @@ -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); }