build: Remove sys_open wrapper
authorAndrew Bartlett <abartlet@samba.org>
Wed, 28 Mar 2012 01:48:00 +0000 (12:48 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 5 Apr 2012 00:39:08 +0000 (02:39 +0200)
16 files changed:
lib/util/become_daemon.c
source3/client/client.c
source3/include/proto.h
source3/lib/pidfile.c
source3/lib/popt_common.c
source3/lib/system.c
source3/libgpo/gpo_filesync.c
source3/modules/vfs_crossrename.c
source3/modules/vfs_default.c
source3/param/loadparm.c
source3/passdb/pdb_smbpasswd.c
source3/rpc_server/samr/srv_samr_chgpasswd.c
source3/smbd/oplock_irix.c
source3/smbd/quotas.c
source3/utils/net_usershare.c
source3/web/neg_lang.c

index 92a75862bdde295bc948c955191944b367c584e1..373927ca6ea95def39716e5aae4189e54897e7b9 100644 (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) {
        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);
                if (i != -1) {
                        ioctl(i, (int) TIOCNOTTY, (char *)0);
                        close(i);
index f10e56348c7396c25c20b1a213edecd31fb8e57e..95500b086216354ef8e016af9a297e67cdc3f3e4 100644 (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 = 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) {
                        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 {
                                }
                        }
                } else {
-                       handle = sys_open(lname, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+                       handle = open(lname, O_WRONLY|O_CREAT|O_TRUNC, 0644);
                }
                newhandle = true;
        }
                }
                newhandle = true;
        }
index 6af0a044e67652d24548698b6c638a00e7c28624..e603d0d839c72cd9a33cc4c7107cb17e8ae0cf53 100644 (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);
              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);
 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);
index 469ddbd95fd83d7c460d7b9ea8df3be7e85cccf9..f1c89ebaf3506cd2d5266e0113a23b07a9c4d806 100644 (file)
@@ -66,7 +66,7 @@ pid_t pidfile_pid(const char *program_name)
 
        SAFE_FREE(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;
        if (fd == -1) {
                SAFE_FREE(pidFile);
                return 0;
@@ -147,7 +147,7 @@ void pidfile_create(const char *program_name)
                exit(1);
        }
 
                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,
                      0644);
        if (fd == -1) {
                DEBUG(0,("ERROR: can't open %s: Error was %s\n", pidFile_name,
index 0c8f691c25596eaf7fe2388573a915ff12a49463..3bcee1c8d7f98754719a8248805329b0d97aff8c 100644 (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) {
                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",
                spec = SMB_STRDUP(p);
                if (fd < 0) {
                        fprintf(stderr, "Error opening PASSWD_FILE %s: %s\n",
index b12def5929890b1739e13ea9ffc2e102f33c6af1..f22215d2a1872435bb1845d0bf4e52a5ae8f2646 100644 (file)
@@ -584,15 +584,6 @@ int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OF
 #endif
 }
 
 #endif
 }
 
-/*******************************************************************
- An open() wrapper.
-********************************************************************/
-
-int sys_open(const char *path, int oflag, mode_t mode)
-{
-       return open(path, oflag, mode);
-}
-
 /*******************************************************************
  An fopen() wrapper.
 ********************************************************************/
 /*******************************************************************
  An fopen() wrapper.
 ********************************************************************/
index 7f0e4107d6c7fcf1cd5d3bbfd9d45993a1949942..6e3efdaf6c1b5a1c91ae84a73647b105425a70d5 100644 (file)
@@ -55,7 +55,7 @@ NTSTATUS gpo_copy_file(TALLOC_CTX *mem_ctx,
                goto out;
        }
 
                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;
        }
                result = map_nt_error_from_unix(errno);
                goto out;
        }
index a54125c32697cc6ec1d3a9937d7e963e1e4a1ac9..a38ae45948ae51d4918dff5b802bb19b798255fa 100644 (file)
@@ -70,16 +70,16 @@ static int copy_reg(const char *source, const char *dest)
                return -1;
        }
 
                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
                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
 #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;
 
 #endif
                goto err;
 
index 35073143c06a8ab522d3435e51f742613a25a91d..615c0296b4683344c7e66abb257c2dc16f16ec9c 100644 (file)
@@ -481,7 +481,7 @@ static int vfswrap_open(vfs_handle_struct *handle,
                goto out;
        }
 
                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;
  out:
        END_PROFILE(syscall_open);
        return result;
index f4e01335c5f323ff8d9102bca7fe70bf1c6dbf18..d48ee795e844c06905e0887ab765cc97dcb426f6 100644 (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
 
        /* 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
 #else
-       fd = sys_open(fname, O_RDONLY, 0);
+       fd = open(fname, O_RDONLY, 0);
 #endif
 
        if (fd == -1) {
 #endif
 
        if (fd == -1) {
index 71b21fbb28fae0d4c14b74b27f029e5cd5625803..7f82c1f7cd744a9172733f21152beb9051dee074 100644 (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++) {
                                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... */
                                                break;
                                        }
                                        usleep(200); /* Spin, spin... */
index 1e8b14ead7fc05b89f6993fdd504b1172974b547..b083fb94bf729c111fee798f215ce32602f33141 100644 (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 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);
                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];
                               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;
                                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. */
        }
 
        /* 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);
        {
                DEBUG(3, ("More weirdness, could not open %s\n", slavedev));
                return (False);
index 2097945b975d83ac6d032bbb9db60e42e4f0514b..aa987fccbb84f0651a05902434feef49ae0a3756 100644 (file)
@@ -64,7 +64,7 @@ static bool irix_oplocks_available(void)
                return False;
        }
 
                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) ));
                DEBUG(0,("check_kernel_oplocks: Unable to open temp test file "
                         "%s. Error was %s\n",
                         tmpname, strerror(errno) ));
index 41516621f0fcd4c1d0e3f65c97f0c1b77ee69d61..c2616157e43fb6b300792872a4eb837ab73b4baf 100644 (file)
@@ -876,7 +876,7 @@ bool disk_quotas(const char *path,
        }
 
        DEBUG(5,("disk_quotas: looking for quotas file \"%s\"\n", name));
        }
 
        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;
        }
                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));
   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);
   }
     set_effective_uid(euser_id);
     return(False);
   }
index 295f9ce4d9b4c17a31cc4d53716f21fd26a36a3b..8f77f739947faa76d2c3e715ad5eda80a74ba236 100644 (file)
@@ -359,9 +359,9 @@ static int info_fn(struct file_list *fl, void *priv)
        }
 
 #ifdef O_NOFOLLOW
        }
 
 #ifdef O_NOFOLLOW
-       fd = sys_open(basepath, O_RDONLY|O_NOFOLLOW, 0);
+       fd = open(basepath, O_RDONLY|O_NOFOLLOW, 0);
 #else
 #else
-       fd = sys_open(basepath, O_RDONLY, 0);
+       fd = open(basepath, O_RDONLY, 0);
 #endif
 
        if (fd == -1) {
 #endif
 
        if (fd == -1) {
index 59475d12b57ccb4299ea44a042a0156f67b51f92..09eff7ea08cc338e5e8cdfff17c4e661455709aa 100644 (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) {
        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;
                        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 */
        }
 
        /* fall through to default name */
-       return sys_open(fname, flags, mode);
+       return open(fname, flags, mode);
 }
 
 
 }