/[path-sandbox]/trunk/libsbutil/get_sandbox_lib.c
Gentoo

Diff of /trunk/libsbutil/get_sandbox_lib.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 93 Revision 97
95SB_STATIC char *get_sandbox_log() 95SB_STATIC char *get_sandbox_log()
96{ 96{
97 char path[SB_PATH_MAX]; 97 char path[SB_PATH_MAX];
98 char *sandbox_log_env = NULL; 98 char *sandbox_log_env = NULL;
99 99
100 sandbox_log_env = getenv(ENV_SANDBOX_LOG);
101
100 /* THIS CHUNK BREAK THINGS BY DOING THIS: 102 /* THIS CHUNK BREAK THINGS BY DOING THIS:
101 * SANDBOX_LOG=/tmp/sandbox-app-admin/superadduser-1.0.7-11063.log 103 * SANDBOX_LOG=/tmp/sandbox-app-admin/superadduser-1.0.7-11063.log
102 */ 104 */
105 if ((NULL != sandbox_log_env) &&
106 (NULL != strchr(sandbox_log_env, '/')))
107 sandbox_log_env = NULL;
103 108
104 sandbox_log_env = getenv(ENV_SANDBOX_LOG);
105 snprintf(path, sizeof(path) - 1, "%s%s%s%d%s", LOG_FILE_PREFIX, 109 snprintf(path, sizeof(path) - 1, "%s%s%s%d%s", LOG_FILE_PREFIX,
106 (sandbox_log_env == NULL ? "" : sandbox_log_env), 110 (sandbox_log_env == NULL ? "" : sandbox_log_env),
107 (sandbox_log_env == NULL ? "" : "-"), getpid(), LOG_FILE_EXT); 111 (sandbox_log_env == NULL ? "" : "-"), getpid(), LOG_FILE_EXT);
112 return (strdup(path));
113}
114
115SB_STATIC char *get_sandbox_debug_log()
116{
117 char path[SB_PATH_MAX];
118 char *sandbox_debug_log_env = NULL;
119
120 sandbox_debug_log_env = getenv(ENV_SANDBOX_DEBUG_LOG);
121
122 /* THIS CHUNK BREAK THINGS BY DOING THIS:
123 * SANDBOX_DEBUG_LOG=/tmp/sandbox-app-admin/superadduser-1.0.7-11063.log
124 */
125 if ((NULL != sandbox_debug_log_env) &&
126 (NULL != strchr(sandbox_debug_log_env, '/')))
127 sandbox_debug_log_env = NULL;
128
129 snprintf(path, sizeof(path) - 1, "%sdebug-%s%s%d%s", LOG_FILE_PREFIX,
130 (sandbox_debug_log_env == NULL ? "" : sandbox_debug_log_env),
131 (sandbox_debug_log_env == NULL ? "" : "-"), getpid(), LOG_FILE_EXT);
108 return (strdup(path)); 132 return (strdup(path));
109} 133}
110 134
111/* Obtain base directory name. Do not allow trailing / */ 135/* Obtain base directory name. Do not allow trailing / */
112SB_STATIC char *sb_dirname(const char *path) 136SB_STATIC char *sb_dirname(const char *path)

Legend:
Removed from v.93  
changed lines
  Added in v.97

  ViewVC Help
Powered by ViewVC 1.1.20