- Timestamp:
- Jul 16, 2011, 12:28:10 AM (14 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- f5f6ec0
- Parents:
- 99ac28a
- git-author:
- David Benjamin <davidben@mit.edu> (07/10/11 19:11:46)
- git-committer:
- David Benjamin <davidben@mit.edu> (07/16/11 00:28:10)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tester.c
r396505be r8219374 4 4 #undef WINDOW 5 5 6 #include <errno.h>7 6 #include <unistd.h> 8 #include <pwd.h>9 7 #include <stdio.h> 10 8 #include <stdlib.h> 11 9 #include <string.h> 12 #include <sys/types.h>13 10 14 11 #undef instr … … 136 133 { 137 134 int numfailed=0; 138 const char *home; 139 char *s, *path; 140 struct passwd *pw; 135 char *s, *path, *home; 141 136 142 137 printf("# BEGIN testing owl_util\n"); … … 274 269 g_free(s); 275 270 276 errno = 0; 277 home = owl_global_get_homedir(&g); 271 home = g_strdup(owl_global_get_homedir(&g)); 278 272 s = owl_util_makepath("~"); 279 273 FAIL_UNLESS("makepath ~", !strcmp(home, s)); … … 285 279 g_free(s); 286 280 g_free(path); 287 288 errno = 0; 289 pw = getpwnam("root"); 290 if (pw) { 291 home = pw->pw_dir; 292 } else { 281 g_free(home); 282 283 home = owl_util_homedir_for_user("root"); 284 if (home == NULL) { 293 285 /* Just make some noise so we notice. */ 294 home = "<WHAT>";295 fprintf(stderr, " getpwnam: %s", errno ? strerror(errno) : "No such user");286 home = g_strdup("<WHAT>"); 287 fprintf(stderr, "owl_util_homedir_for_user failed"); 296 288 } 297 289 … … 305 297 g_free(s); 306 298 g_free(path); 299 g_free(home); 307 300 308 301 /* if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); */
Note: See TracChangeset
for help on using the changeset viewer.