[OpenAFS-devel] [PATCH] fix various minor problems in aklog
Christopher Allen Wing
wingc@engin.umich.edu
Thu, 14 Jul 2005 14:54:54 -0400 (EDT)
Here is a patch against today's CVS to fix some minor problems in the
aklog source:
- main() returns type int
- various missing #includes
- remove unused variables
- call pr_Initialize() with correct number of arguments
- call pr_SNameToId() with correct argument type (int32 not long)
- use getcwd() not getwd()
You can download it from here:
http://www-personal.engin.umich.edu/~wingc/openafs/patches/openafs-20050717-aklog.patch
or just pull it off this email.
Thanks,
Chris Wing
wingc@engin.umich.edu
diff -uNr openafs-20050717.orig/src/aklog/aklog.c openafs-20050717/src/aklog/aklog.c
--- openafs-20050717.orig/src/aklog/aklog.c 2005-06-30 17:06:15.000000000 -0400
+++ openafs-20050717/src/aklog/aklog.c 2005-07-14 14:45:20.062537544 -0400
@@ -14,6 +14,7 @@
#ifndef WINDOWS
+int
#ifdef __STDC__
main(int argc, char *argv[])
#else
diff -uNr openafs-20050717.orig/src/aklog/aklog_main.c openafs-20050717/src/aklog/aklog_main.c
--- openafs-20050717.orig/src/aklog/aklog_main.c 2005-07-05 11:08:34.000000000 -0400
+++ openafs-20050717/src/aklog/aklog_main.c 2005-07-14 14:46:53.253370384 -0400
@@ -81,6 +81,7 @@
#include <afs/vice.h>
#include <afs/venus.h>
#include <afs/ptserver.h>
+#include <afs/ptuser.h>
#include <afs/dirpath.h>
#endif /* WINDOWS */
@@ -259,7 +260,6 @@
{
int status = AKLOG_SUCCESS;
struct afsconf_dir *configdir;
- char *dirpath;
memset(local_cell, 0, sizeof(local_cell));
memset((char *)cellconfig, 0, sizeof(*cellconfig));
@@ -404,7 +404,7 @@
{
int status = AKLOG_SUCCESS;
char username[BUFSIZ]; /* To hold client username structure */
- long viceId; /* AFS uid of user */
+ afs_int32 viceId; /* AFS uid of user */
char name[ANAME_SZ]; /* Name of afs key */
char primary_instance[INST_SZ]; /* Instance of afs key */
@@ -720,7 +720,7 @@
strcpy(lastcell, aserver.cell);
- if (!pr_Initialize (0, confname, aserver.cell, 0))
+ if (!pr_Initialize (0, confname, aserver.cell))
status = pr_SNameToId (username, &viceId);
if (dflag) {
@@ -775,7 +775,7 @@
* level
*/
- if ((status = pr_Initialize(1L, confname, aserver.cell, 0))) {
+ if ((status = pr_Initialize(1L, confname, aserver.cell))) {
printf("Error %d\n", status);
}
@@ -1143,7 +1143,7 @@
if (path[0] == DIR)
strcpy(pathtocheck, path);
else {
- if (getwd(pathtocheck) == NULL) {
+ if (getcwd(pathtocheck, sizeof(pathtocheck)) == NULL) {
fprintf(stderr, "Unable to find current working directory:\n");
fprintf(stderr, "%s\n", pathtocheck);
fprintf(stderr, "Try an absolute pathname.\n");
diff -uNr openafs-20050717.orig/src/aklog/krb_util.c openafs-20050717/src/aklog/krb_util.c
--- openafs-20050717.orig/src/aklog/krb_util.c 2005-06-30 17:06:15.000000000 -0400
+++ openafs-20050717/src/aklog/krb_util.c 2005-07-14 14:47:17.057751568 -0400
@@ -36,13 +36,14 @@
#endif /* WINDOWS */
+#include <string.h>
+
#define S_AD_SZ sizeof(struct sockaddr_in)
char *afs_realm_of_cell(context, cellconfig)
krb5_context context;
struct afsconf_cell *cellconfig;
{
- char krbhst[MAX_HSTNM];
static char krbrlm[REALM_SZ+1];
char **hrealms = 0;
krb5_error_code retval;
diff -uNr openafs-20050717.orig/src/aklog/linked_list.c openafs-20050717/src/aklog/linked_list.c
--- openafs-20050717.orig/src/aklog/linked_list.c 2004-11-19 15:01:29.000000000 -0500
+++ openafs-20050717/src/aklog/linked_list.c 2005-07-14 14:47:38.972420032 -0400
@@ -12,6 +12,8 @@
#endif /* lint || SABER */
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include "linked_list.h"
#ifndef NULL
@@ -26,8 +28,6 @@
#define FALSE 0
#endif
-char *calloc();
-
#ifdef __STDC__
void ll_init(linked_list *list)
/*