Skip to content

Commit

Permalink
build: Remove sys_open wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
abartlet committed Apr 5, 2012
1 parent 9cc056e commit d166b79
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 34 deletions.
2 changes: 1 addition & 1 deletion lib/util/become_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions source3/client/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion source3/include/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions source3/lib/pidfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion source3/lib/popt_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 0 additions & 9 deletions source3/lib/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
********************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion source3/libgpo/gpo_filesync.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions source3/modules/vfs_crossrename.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion source3/modules/vfs_default.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions source3/param/loadparm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion source3/passdb/pdb_smbpasswd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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... */
Expand Down
6 changes: 3 additions & 3 deletions source3/rpc_server/samr/srv_samr_chgpasswd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source3/smbd/oplock_irix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) ));
Expand Down
4 changes: 2 additions & 2 deletions source3/smbd/quotas.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions source3/utils/net_usershare.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions source3/web/neg_lang.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}


Expand Down

0 comments on commit d166b79

Please sign in to comment.