From 580f1ffc506bb925c28af824e08f84318f1dca64 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 22 May 2003 05:57:31 +0000 Subject: [PATCH] switch-to-strerror-20030522 FIXES 1458 your brights brighter, your whites whiter. well, at least compilers won't bitch that sys_errlist[] isn't supported anymore. --- src/uss/uss_procs.c | 36 ++++++++++++++++++------------------ src/uss/uss_vol.c | 6 +++--- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/uss/uss_procs.c b/src/uss/uss_procs.c index 60695c0..b4c8792 100644 --- a/src/uss/uss_procs.c +++ b/src/uss/uss_procs.c @@ -116,7 +116,7 @@ afs_int32 uss_procs_BuildDir(a_path, a_mode, a_owner, a_access) if (errno != EEXIST) { uss_procs_PrintErr(line, "Failed to create directory '%s': %s\n", - a_path, sys_errlist[errno]); + a_path, strerror(errno)); return(1); } /*Directory didn't exist*/ } /*Create the directory*/ @@ -131,13 +131,13 @@ afs_int32 uss_procs_BuildDir(a_path, a_mode, a_owner, a_access) if (chmod(a_path, m)) { uss_procs_PrintErr(line, "Can't chmod() directory '%s' to be '%s' : %s\n", - a_path, a_mode, sys_errlist[errno]); + a_path, a_mode, strerror(errno)); return(1); } /* chmod the directory */ if (chown(a_path, o, -1)) { uss_procs_PrintErr(line, "Can't chown() directory '%s' to be owned by '%s' (uid %d): %s\n", - a_path, a_owner, o, sys_errlist[errno]); + a_path, a_owner, o, strerror(errno)); return(1); } /*Couldn't chown*/ } /*Not a dry run*/ @@ -236,7 +236,7 @@ afs_int32 uss_procs_CpFile(a_path, a_mode, a_owner, a_proto) if (stat(temp, &stbuf)) { uss_procs_PrintErr(line, "Failed to stat '%s': %s\n", - a_proto, sys_errlist[errno]); + a_proto, strerror(errno)); return(1); } @@ -270,7 +270,7 @@ afs_int32 uss_procs_CpFile(a_path, a_mode, a_owner, a_proto) if (chown(a_path, o, -1)) { uss_procs_PrintErr(line, "Can't chown() file '%s' to be owned by '%s' (uid %d): %s\n", - a_path, a_owner, o, sys_errlist[errno]); + a_path, a_owner, o, strerror(errno)); return(1); } /*chown failed*/ } /*Not a dry run*/ @@ -350,7 +350,7 @@ afs_int32 uss_procs_EchoToFile(a_path, a_mode, a_owner, a_content) if (chown(a_path, o, -1)){ uss_procs_PrintErr(line, "Can't chown() file '%s' to be owned by '%s' (uid %d): %s\n", - a_path, a_owner, o, sys_errlist[errno]); + a_path, a_owner, o, strerror(errno)); return(1); } } /*Not a dry run*/ @@ -391,7 +391,7 @@ afs_int32 uss_procs_Exec(a_command) if (system(a_command)) { uss_procs_PrintErr(line, "Failed to run the '%s' command: %s\n", - a_command, sys_errlist[errno]); + a_command, strerror(errno)); return(1); } } /*Not a dry run*/ @@ -450,7 +450,7 @@ afs_int32 uss_procs_SetLink(a_path1, a_path2, a_type) if (symlink(a_path1, a_path2)) { uss_procs_PrintErr(line, "Failed to make symlink '%s' to '%s': %s\n", - a_path1, a_path2, sys_errlist[errno]); + a_path1, a_path2, strerror(errno)); return(1); } } /*Dry run*/ @@ -467,7 +467,7 @@ afs_int32 uss_procs_SetLink(a_path1, a_path2, a_type) if (link(a_path1, a_path2)) { uss_procs_PrintErr(line, "Failed to make hard link '%s' to '%s': %s\n", - a_path1, a_path2, sys_errlist[errno]); + a_path1, a_path2, strerror(errno)); return(1); } } /*Dry run*/ @@ -567,19 +567,19 @@ static int Copy(a_from, a_to, a_mode) if (fd1 < 0) { uss_procs_PrintErr(line, "%s: Failed to open '%s' for overwrite: %s.\n", - uss_whoami, a_to, sys_errlist[errno]); + uss_whoami, a_to, strerror(errno)); return(1); } } else { uss_procs_PrintErr(line, "%s: Failed to open '%s': %s.\n", - uss_whoami, a_to, sys_errlist[errno]); + uss_whoami, a_to, strerror(errno)); return(1); } } if ((fd2 = open(a_from, O_RDONLY, 0)) < 0) { uss_procs_PrintErr(line, "%s: Error reading '%s': %s\n", - uss_whoami, a_from, sys_errlist[errno]); + uss_whoami, a_from, strerror(errno)); close(fd1); return(1); } @@ -591,12 +591,12 @@ static int Copy(a_from, a_to, a_mode) if (rc) { uss_procs_PrintErr(line, "Failed to close '%s' %s\n", - a_to, sys_errlist[errno]); + a_to, strerror(errno)); return(1); } if(rc = close(fd2)) uss_procs_PrintErr(line, "Warning: Failed to close '%s': %s\n", - a_from, sys_errlist[errno]); + a_from, strerror(errno)); return(0); } /*Copy*/ @@ -649,12 +649,12 @@ static int Echo(a_s, a_f, a_mode) if (fd < 0) { uss_procs_PrintErr(line, "%s: Failed to open '%s' for overwrite: %s.\n", - uss_whoami, a_f, sys_errlist[errno]); + uss_whoami, a_f, strerror(errno)); return(1); } } else { uss_procs_PrintErr(line, "%s: Failed to open '%s': %s. \n", - uss_whoami, a_f, sys_errlist[errno]); + uss_whoami, a_f, strerror(errno)); return(1); } } @@ -662,7 +662,7 @@ static int Echo(a_s, a_f, a_mode) write(fd, "\n", 1); if (close(fd)){ uss_procs_PrintErr(line, "Failed to close '%s': %s\n", - a_f, sys_errlist[errno]); + a_f, strerror(errno)); return(1); } return(0); @@ -865,7 +865,7 @@ FILE *uss_procs_FindAndOpen(a_fileToOpen) if (cant_read) fprintf(stderr, "%s: Can't open template '%s': %s\n", - uss_whoami, tmp_str, sys_errlist[errno]); + uss_whoami, tmp_str, strerror(errno)); else { fprintf(stderr, "%s: Can't find template '%s' in searchlist", diff --git a/src/uss/uss_vol.c b/src/uss/uss_vol.c index e033e73..336dbd9 100644 --- a/src/uss/uss_vol.c +++ b/src/uss/uss_vol.c @@ -779,7 +779,7 @@ afs_int32 uss_vol_CreateVol(a_volname, a_server, a_partition, a_quota, a_mpoint, else { uss_procs_PrintErr(line, "Couldn't create volume '%s' [error %d]: %s\n", - a_volname, code, sys_errlist[errno]); + a_volname, code, strerror(errno)); return(1); } /*Failure was NOT because it already existed*/ } /*UV_CreateVolume failed*/ @@ -837,7 +837,7 @@ afs_int32 uss_vol_CreateVol(a_volname, a_server, a_partition, a_quota, a_mpoint, } else { fprintf(stderr,"%s: Can't mount volume '%s' on '%s': %s\n", - uss_whoami, a_volname, a_mpoint, sys_errlist[errno]); + uss_whoami, a_volname, a_mpoint, strerror(errno)); if (Oldmpoint) free(Oldmpoint); return(1); @@ -871,7 +871,7 @@ afs_int32 uss_vol_CreateVol(a_volname, a_server, a_partition, a_quota, a_mpoint, if (chown(a_mpoint, o, -1)) { fprintf(stderr, "%s: Can't chown() mountpoint '%s' to owner '%s' (uid %d): %s\n", - uss_whoami, a_mpoint, a_owner, o, sys_errlist[errno]); + uss_whoami, a_mpoint, a_owner, o, strerror(errno)); if (Oldmpoint) free(Oldmpoint); return(1); -- 1.9.4