/**
Check if a process exists. Does this work on all unixes?
**/
-_PUBLIC_ bool process_exists(pid_t pid);
+_PUBLIC_ bool process_exists_by_pid(pid_t pid);
/**
Simple routine to do POSIX file locking. Cruft in NFS and 64->32 bit mapping
$(SOCKET_WRAPPER_OBJ) \
$(NSS_WRAPPER_OBJ)
-LIB_OBJ = $(LIBSAMBAUTIL_OBJ) \
+UTIL_OBJ = ../lib/util/rbtree.o ../lib/util/signal.o ../lib/util/time.o \
+ ../lib/util/xfile.o ../lib/util/util_strlist.o \
+ ../lib/util/util_file.o ../lib/util/data_blob.o \
+ ../lib/util/util.o ../lib/util/fsusage.o
+
+CRYPTO_OBJ = ../lib/crypto/crc32.o ../lib/crypto/md5.o \
+ ../lib/crypto/hmacmd5.o ../lib/crypto/arcfour.o \
+ ../lib/crypto/md4.o
+
+LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) \
lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \
lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o \
- lib/interfaces.o ../lib/util/rbtree.o lib/memcache.o \
+ lib/interfaces.o lib/memcache.o \
lib/util_transfer_file.o lib/async_req.o \
lib/async_sock.o \
$(TDB_LIB_OBJ) \
$(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
- lib/interface.o ../lib/crypto/md4.o \
- lib/pidfile.o \
- ../lib/util/signal.o lib/system.o lib/sendfile.o lib/recvfile.o lib/time.o \
- ../lib/util/time.o \
+ lib/interface.o lib/pidfile.o \
+ lib/system.o lib/sendfile.o lib/recvfile.o lib/time.o \
lib/ufc.o lib/genrand.o lib/username.o \
lib/util_pw.o lib/access.o lib/smbrun.o \
- lib/bitmap.o ../lib/crypto/crc32.o lib/dprintf.o $(UTIL_REG_OBJ) \
- ../lib/util/xfile.o ../lib/util/util_strlist.o lib/wins_srv.o \
+ lib/bitmap.o lib/dprintf.o $(UTIL_REG_OBJ) \
+ lib/wins_srv.o \
lib/util_str.o lib/clobber.o lib/util_sid.o lib/util_uuid.o \
- lib/util_unistr.o ../lib/util/util_file.o lib/util_file.o ../lib/util/data_blob.o \
- lib/util.o ../lib/util/util.o lib/util_sock.o lib/sock_exec.o lib/util_sec.o \
- lib/substitute.o ../lib/util/fsusage.o lib/dbwrap_util.o \
+ lib/util_unistr.o lib/util_file.o \
+ lib/util.o lib/util_sock.o lib/sock_exec.o lib/util_sec.o \
+ lib/substitute.o lib/dbwrap_util.o \
lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \
lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \
- ../lib/crypto/md5.o ../lib/crypto/hmacmd5.o ../lib/crypto/arcfour.o \
lib/iconv.o lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \
lib/adt_tree.o lib/gencache.o \
lib/module.o lib/events.o lib/ldap_escape.o @CHARSET_STATIC@ \
strlower_m(finfo->name);
}
- if (!directory_exist(finfo->name,NULL) &&
+ if (!directory_exist(finfo->name) &&
mkdir(finfo->name,0777) != 0) {
d_printf("failed to create directory %s\n",finfo->name);
client_set_cur_dir(saved_curdir);
SMB_STRUCT_STAT st;
/* allow '-' to represent stdin
jdblair, 24.jun.98 */
- if (!file_exist(lname,&st) &&
+ if (!file_exist_stat(lname,&st) &&
(strcmp(lname,"-"))) {
d_printf("%s does not exist\n",lname);
return 1;
return 1;
}
- if (!file_exist(local_name, &st)) {
+ if (!file_exist_stat(local_name, &st)) {
d_printf("%s does not exist\n", local_name);
return 1;
}
/*
* Get the names and addresses of the client and server...
*/
- myname = get_myname(talloc_tos());
+ myname = talloc_get_myname(talloc_tos());
if (!myname) {
return NULL;
}
/* Ensure this db is created read/write for root only. */
ldb_set_create_perms(ldb, 0600);
- existed = file_exist(db_path, NULL);
+ existed = file_exist(db_path);
if (lp_parm_bool(-1, "groupmap", "nosync", False)) {
flags |= LDB_FLG_NOSYNC;
/* possibly upgrade */
tdb_path = state_path("group_mapping.tdb");
- if (file_exist(tdb_path, NULL) && !mapping_upgrade(tdb_path)) {
+ if (file_exist(tdb_path) && !mapping_upgrade(tdb_path)) {
unlink(state_path("group_mapping.ldb"));
goto failed;
}
gid_t **gids, size_t *num_gids);
const char *get_numlist(const char *p, uint32 **num, int *count);
bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
+bool file_exist(const char *fname);
bool socket_exist(const char *fname);
time_t file_modtime(const char *fname);
bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st);
+bool directory_exist(char *dname);
SMB_OFF_T get_file_size(char *file_name);
char *attrib_string(uint16 mode);
void show_msg(char *buf);
void *element, void *_array, uint32 *num_elements,
ssize_t *array_size);
void safe_free(void *p);
-char *get_myname_talloc(TALLOC_CTX *ctx);
+char *talloc_get_myname(TALLOC_CTX *ctx);
char *get_mydnsdomname(TALLOC_CTX *ctx);
int interpret_protocol(const char *str,int def);
char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
WERROR werr;
uint64_t new_csn;
- if (!file_exist(ctx->path, NULL)) {
+ if (!file_exist(ctx->path)) {
return WERR_BADFILE;
}
}
trim_string(fname,"","/");
- if (!directory_exist_stat(fname,NULL)) {
+ if (!directory_exist(fname)) {
mkdir(fname,0755);
}
if ( lp_loaded() ) {
const char *fname = lp_configfile();
- if (file_exist(fname,NULL) && !strcsequal(fname,get_dyn_CONFIGFILE())) {
+ if (file_exist(fname) && !strcsequal(fname,get_dyn_CONFIGFILE())) {
set_dyn_CONFIGFILE(fname);
test = False;
}
}
#endif
- if (!directory_exist(lp_lockdir(), NULL)) {
+ if (!directory_exist(lp_lockdir())) {
mkdir(lp_lockdir(), 0755);
}
("get_mydnsdomname failed.\n"));
return;
}
- hostname = get_myname(talloc_tos());
+ hostname = talloc_get_myname(talloc_tos());
if (!hostname) {
DEBUG(2,
("get_myname failed.\n"));
string_set(ptr, fname);
- if (file_exist(fname, NULL)) {
+ if (file_exist(fname)) {
bool ret = pm_process(fname, do_section, do_parameter, NULL);
SAFE_FREE(fname);
return ret;
/* no registry keys; just create the perfmon directory */
- if ( !directory_exist( p, NULL ) )
+ if ( !directory_exist( p ) )
mkdir( p, 0755 );
return;
result->abstract_syntax = *abstract_syntax;
result->transfer_syntax = ndr_transfer_syntax;
- result->desthost = get_myname(result);
+ result->desthost = talloc_get_myname(result);
result->srv_name_slash = talloc_asprintf_strupper_m(
result, "\\\\%s", result->desthost);
if ((result->desthost == NULL) || (result->srv_name_slash == NULL)) {
/* make sure that the eventlog dir exists */
eventlogdir = state_path( "eventlog" );
- if ( !directory_exist( eventlogdir, NULL ) )
+ if ( !directory_exist( eventlogdir ) )
mkdir( eventlogdir, 0755 );
/* get the path on disk */
if (lp_loaded()) {
char *fname = lp_configfile();
- if (file_exist(fname, NULL) &&
+ if (file_exist(fname) &&
!strcsequal(fname, get_dyn_CONFIGFILE())) {
set_dyn_CONFIGFILE(fname);
test = False;
setpgid( (pid_t)0, (pid_t)0);
#endif
- if (!directory_exist(lp_lockdir(), NULL))
+ if (!directory_exist(lp_lockdir()))
mkdir(lp_lockdir(), 0755);
if (is_daemon)
if (lp_loaded()) {
const char *fname = lp_configfile();
- if (file_exist(fname, NULL) &&
+ if (file_exist(fname) &&
!strcsequal(fname, get_dyn_CONFIGFILE())) {
set_dyn_CONFIGFILE(fname);
test = False;
ret = 1;
}
- if (!directory_exist(lp_lockdir(), &st)) {
+ if (!directory_exist_stat(lp_lockdir(), &st)) {
fprintf(stderr, "ERROR: lock directory %s does not exist\n",
lp_lockdir());
ret = 1;
ret = 1;
}
- if (!directory_exist(lp_piddir(), &st)) {
+ if (!directory_exist_stat(lp_piddir(), &st)) {
fprintf(stderr, "ERROR: pid directory %s does not exist\n",
lp_piddir());
ret = 1;
if (S_ISDIR(st.st_mode))
{
snprintf(buf, sizeof(buf), "%s/index.html", file);
- if (!file_exist(buf, &st) || !S_ISREG(st.st_mode))
+ if (!file_exist_stat(buf, &st) || !S_ISREG(st.st_mode))
{
cgi_setup_error("404 File Not Found","",
"The requested file was not found");
****************************************************************************/
static void welcome_page(void)
{
- if (file_exist("help/welcome.html", NULL)) {
+ if (file_exist("help/welcome.html")) {
include_html("help/welcome.html");
} else {
include_html("help/welcome-no-samba-doc.html");
cgi_load_variables();
- if (!file_exist(get_dyn_CONFIGFILE(), NULL)) {
+ if (!file_exist(get_dyn_CONFIGFILE())) {
have_read_access = True;
have_write_access = True;
} else {
goto done;
}
- if (!file_exist(tdbfile, &stbuf)) {
+ if (!file_exist_stat(tdbfile, &stbuf)) {
tdb_is_new = True;
}
if (lp_loaded()) {
const char *fname = lp_configfile();
- if (file_exist(fname,NULL) && !strcsequal(fname,get_dyn_CONFIGFILE())) {
+ if (file_exist(fname) && !strcsequal(fname,get_dyn_CONFIGFILE())) {
set_dyn_CONFIGFILE(fname);
}
}
exit(1);
}
- if (!directory_exist(lp_lockdir(), NULL)) {
+ if (!directory_exist(lp_lockdir())) {
mkdir(lp_lockdir(), 0755);
}
ret = (pid_t)atoi(pidstr);
- if (!process_exists(ret)) {
+ if (!process_exists_by_pid(ret)) {
goto noproc;
}