AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h ucontext.h)
AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
-AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp)
+AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp vsnprintf)
AC_CHECK_TYPE(ssize_t, int)
AC_SIZEOF_TYPE(long)
#define SplitOffsetOrSize(t,h,l) (h) = 0; (l) = (t);
#endif /* !AFS_LARGEFILE_ENV */
+/* Maximum integer sizes. Also what is expected by %lld, %llu in
+ * afs_snprintf. */
+#ifdef AFS_64BIT_CLIENT
+typedef afs_int64 afs_intmax_t;
+typedef afs_uint64 afs_uintmax_t;
+#else /* !AFS_64BIT_CLIENT */
+typedef afs_int32 afs_intmax_t;
+typedef afs_uint32 afs_uintmax_t;
+#endif /* !AFS_64BIT_CLIENT */
+
/* you still have to include <netinet/in.h> to make these work */
#define hton32 htonl
${DEST}/lib/afs/libafsutil.a \
${DEST}/bin/sys
+splint:
+ splint $(CFLAGS) \
+ assert.c base64.c casestrcpy.c ktime.c volparse.c hostparse.c \
+ hputil.c kreltime.c isathing.c get_krbrlm.c uuid.c serverLog.c \
+ dirpath.c fileutil.c netutils.c flipbase64.c \
+ afs_atomlist.c afs_lhash.c snprintf.c
extern int ReOpenLog(const char *fileName);
extern void SetupLogSignals(void);
+extern int
+afs_vsnprintf(/*@out@*/char *p, size_t avail, const char *fmt,
+ va_list ap)
+ /*@requires maxSet(p) >= (avail-1)@*/
+ /*@modifies p@*/;
+
+extern /*@printflike@*/ int
+afs_snprintf(/*@out@*/char *p, size_t avail,
+ const char *fmt, ...)
+ /*@requires maxSet(p) >= (avail-1)@*/
+ /*@modifies p@*/;
+
/* special version of ctime that clobbers a *different static variable, so
* that ViceLog can call ctime and not cause buffer confusion.
/* Additional macros for ease of use */
/* buf is expected to be atleast AFS_PATH_MAX bytes long */
#define AFSDIR_SERVER_DIRPATH(buf, dir) \
- strcompose(buf, AFSDIR_PATH_MAX, serverPrefix, dir, NULL)
+ (void) strcompose(buf, AFSDIR_PATH_MAX, serverPrefix, dir, NULL)
#define AFSDIR_SERVER_FILEPATH(buf, dir, file) \
- strcompose(buf, AFSDIR_PATH_MAX, serverPrefix, dir, "/", file, NULL)
+ (void) strcompose(buf, AFSDIR_PATH_MAX, serverPrefix, dir, "/", file, NULL)
#define AFSDIR_CLIENT_DIRPATH(buf, dir) \
- strcompose(buf, AFSDIR_PATH_MAX, clientPrefix, dir, NULL)
+ (void) strcompose(buf, AFSDIR_PATH_MAX, clientPrefix, dir, NULL)
#define AFSDIR_CLIENT_FILEPATH(buf, dir, file) \
- strcompose(buf, AFSDIR_PATH_MAX, clientPrefix, dir, "/", file, NULL)
+ (void) strcompose(buf, AFSDIR_PATH_MAX, clientPrefix, dir, "/", file, NULL)
/* initAFSDirPath() -- External users call this function to initialize
{
LOCK_SERVERLOG();
if (serverLogFD > 0)
- write(serverLogFD, buf, len);
+ (void) write(serverLogFD, buf, len);
UNLOCK_SERVERLOG();
}
if (mrafsStyleLogs) {
name = (*threadNameProgram)();
- sprintf(info, "[%s] ", name);
+ (void) afs_snprintf(info, (sizeof tbuffer) - strlen(tbuffer),
+ "[%s] ", name);
info += strlen(info);
}
- (void) vsprintf(info, format, args);
+ (void) afs_vsnprintf(info, (sizeof tbuffer) - strlen(tbuffer),
+ format, args);
len = strlen(tbuffer);
LOCK_SERVERLOG();
} else
#endif
if (serverLogFD > 0)
- write(serverLogFD, tbuffer, len);
+ (void) write(serverLogFD, tbuffer, len);
UNLOCK_SERVERLOG();
#if !defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
IOMGR_SoftSig(DebugOn, LogLevel);
#endif /* AFS_PTHREAD_ENV */
- signal(signo, SetDebug_Signal); /* on some platforms, this signal */
- /* handler needs to be set again */
+ (void) signal(signo, SetDebug_Signal); /* on some platforms, this
+ * signal handler needs to
+ * be set again */
} /*SetDebug_Signal*/
void ResetDebug_Signal(int signo)
IOMGR_SoftSig(DebugOn, (void *)LogLevel);
#endif /* AFS_PTHREAD_ENV */
- signal(signo, ResetDebug_Signal); /* on some platforms, this signal */
- /* handler needs to be set again */
+ (void) signal(signo, ResetDebug_Signal); /* on some platforms,
+ * this signal handler
+ * needs to be set
+ * again */
if (mrafsStyleLogs)
OpenLog((char *)&ourName);
} /*ResetDebug_Signal*/
void SetupLogSignals(void)
{
- signal(SIGHUP, ResetDebug_Signal);
+ (void) signal(SIGHUP, ResetDebug_Signal);
/* Note that we cannot use SIGUSR1 -- Linux stole it for pthreads! */
- signal(SIGTSTP, SetDebug_Signal);
+ (void) signal(SIGTSTP, SetDebug_Signal);
}
int OpenLog(const char *fileName)
if (strncmp(fileName, (char *)&ourName, strlen(fileName)))
strcpy((char *)&ourName, (char *) fileName);
}
- sprintf(FileName, "%s.%d%02d%02d%02d%02d%02d", ourName,
+ afs_snprintf(FileName, MAXPATHLEN, "%s.%d%02d%02d%02d%02d%02d",
+ ourName,
TimeFields->tm_year + 1900, TimeFields->tm_mon + 1,
TimeFields->tm_mday, TimeFields->tm_hour,
TimeFields->tm_min, TimeFields->tm_sec);
serverLogFD = tempfd;
#else
close(tempfd); /* just checking.... */
- freopen(fileName, "w", stdout);
- freopen(fileName, "w", stderr);
+ (void) freopen(fileName, "w", stdout);
+ (void) freopen(fileName, "w", stderr);
serverLogFD = fileno(stdout);
#endif /* AFS_PTHREAD_ENV */
}
close(tempfd);
- freopen(fileName, "a", stdout);
- freopen(fileName, "a", stderr);
+ (void) freopen(fileName, "a", stdout);
+ (void) freopen(fileName, "a", stderr);
serverLogFD = fileno(stdout);
RCSID("$Header$");
-#if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) && !defined(AFS_SUN56_ENV)) || !defined(HAVE_SNPRINTF)
#include <sys/types.h>
#include <stdarg.h>
#include <stdio.h>
* to receive it. The minimum length is <prec> or ceil(log{base}(val)),
* whichever is larger, plus room for a trailing NUL.
*/
-static void mkint(char *buf, unsigned long val, int base, int uc, int prec)
+static void mkint(char *buf, afs_uintmax_t val,
+ int base, int uc, unsigned prec)
{
int len = 0, dig, i;
* both '0' and ' ' are given, the ' ' flag will be ignored.
* + The '#' and '+' flags have no effect.
*/
-#ifdef AFS_AIX51_ENV
-static int vsnprintf(char *p, size_t avail, const char *fmt, va_list ap)
-#else
-static void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
-#endif
+int afs_vsnprintf(char *p, size_t avail, const char *fmt, va_list ap)
{
unsigned int width, precision, haveprec, len;
int ljust, plsign, spsign, altform, zfill;
char *x, *y, xbuf[MAXPREC + 21], fbuf[20];
struct hostent *he;
struct in_addr ia;
- unsigned long UVAL;
- long SVAL, *lcountp;
+ afs_uintmax_t UVAL;
+ afs_intmax_t SVAL;
+ afs_intmax_t* llcountp;
+ long *lcountp;
double FVAL;
short *hcountp;
while (*fmt) {
switch (*fmt) {
case 'h': hflag = 1; fmt++; continue; /* short argument */
- case 'l': lflag = 1; fmt++; continue; /* long argument */
+ case 'l': lflag += 1; fmt++; continue; /* long argument */
+ case 'L': lflag = 2; fmt++; continue; /* long long argument */
default: break;
}
break;
case 'i':
case 'd': /* signed decimal integer */
- if (lflag) SVAL = va_arg(ap, long);
+ if (lflag > 1) SVAL = va_arg(ap, afs_intmax_t);
+ else if (lflag) SVAL = va_arg(ap, long);
else if (hflag) SVAL = va_arg(ap, short);
else SVAL = va_arg(ap, int);
UVAL = (SVAL < 0) ? -SVAL : SVAL;
case 'o': /* unsigned octal integer */
- if (lflag) UVAL = va_arg(ap, unsigned long);
+ if (lflag > 1) UVAL = va_arg(ap, afs_uintmax_t);
+ else if (lflag) UVAL = va_arg(ap, unsigned long);
else if (hflag) UVAL = va_arg(ap, unsigned short);
else UVAL = va_arg(ap, unsigned int);
break;
case 'u': /* unsigned decimal integer */
- if (lflag) UVAL = va_arg(ap, unsigned long);
+ if (lflag > 1) UVAL = va_arg(ap, afs_uintmax_t);
+ else if (lflag) UVAL = va_arg(ap, unsigned long);
else if (hflag) UVAL = va_arg(ap, unsigned short);
else UVAL = va_arg(ap, unsigned int);
case 'x':
case 'X': /* unsigned hexadecimal integer */
- if (lflag) UVAL = va_arg(ap, unsigned long);
+ if (lflag > 1) UVAL = va_arg(ap, afs_uintmax_t);
+ else if (lflag) UVAL = va_arg(ap, unsigned long);
else if (hflag) UVAL = va_arg(ap, unsigned short);
else UVAL = va_arg(ap, unsigned int);
break;
case 'n': /* report count so far */
- if (lflag) {
+ if (lflag > 1) {
+ llcountp = va_arg(ap, afs_intmax_t *);
+ *llcountp = (long long) count;
+ } else if (lflag) {
lcountp = va_arg(ap, long *);
- *lcountp = count;
+ *lcountp = (long) count;
} else if (hflag) {
hcountp = va_arg(ap, short *);
- *hcountp = count;
+ *hcountp = (short) count;
} else {
countp = va_arg(ap, int *);
*countp = count;
if (ljust) while (j-- > 0) *p++ = ' ';
}
*p = 0;
+ return count;
}
+int afs_snprintf(char *p, size_t avail, const char *fmt, ...)
+{
+ va_list ap;
+ int result;
+
+ va_start(ap, fmt);
+ result = afs_vsnprintf(p, avail, fmt, ap);
+ va_end(ap);
+ return result;
+}
+
+#if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) && !defined(AFS_SUN56_ENV)) || !defined(HAVE_VSNPRINTF)
+
+#ifdef AFS_AIX51_ENV
+int vsnprintf(char *p, size_t avail, const char *fmt, va_list ap)
+#else
+void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
+#endif
+{
+ int result;
+ result = afs_vsnprintf(p, avail, fmt, ap);
+#ifdef AFS_AIX51_ENV
+ return result;
+#endif
+}
+#endif /* AFS_OSF20_ENV || AFS_AIX32_ENV */
+
+#if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) && !defined(AFS_SUN56_ENV)) || !defined(HAVE_SNPRINTF)
#ifdef AFS_AIX51_ENV
int snprintf(char *p, size_t avail, const char *fmt, ...)
void snprintf(char *p, unsigned int avail, char *fmt, ...)
#endif
{
- va_list ap;
+ va_list ap;
+ int result;
- va_start(ap, fmt);
- vsnprintf(p, avail, fmt, ap);
- va_end(ap);
+ va_start(ap, fmt);
+ result = afs_vsnprintf(p, avail, fmt, ap);
+ va_end(ap);
+#ifdef AFS_AIX51_ENV
+ return result;
+#endif
}
#endif /* AFS_OSF20_ENV || AFS_AIX32_ENV */
/* error in creating inode */
if (!VALID_INO(inode))
{
- ViceLog(0, ("Volume : %d vnode = %d Failed to create inode: errno = %d\n",
+ ViceLog(0, ("Volume : %u vnode = %u Failed to create inode: errno = %d\n",
(*targetptr)->volumePtr->header->diskstuff.id,
(*targetptr)->vnodeNumber,
errno));
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- ViceLog(1,("SRXAFS_FetchData, Fid = %u.%d.%d\n",
+ ViceLog(1,("SRXAFS_FetchData, Fid = %u.%u.%u\n",
Fid->Volume, Fid->Vnode, Fid->Unique));
FS_LOCK
AFSCallStats.FetchData++, AFSCallStats.TotalCalls++;
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(5,("SRXAFS_FetchData, Fid = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(5,("SRXAFS_FetchData, Fid = %u.%u.%u, Host %s, Id %d\n",
Fid->Volume, Fid->Vnode, Fid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
/*
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- ViceLog(1, ("SAFS_FetchACL, Fid = %u.%d.%d\n",
+ ViceLog(1, ("SAFS_FetchACL, Fid = %u.%u.%u\n",
Fid->Volume, Fid->Vnode, Fid->Unique));
FS_LOCK
AFSCallStats.FetchACL++, AFSCallStats.TotalCalls++;
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(5, ("SAFS_FetchACL, Fid = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(5, ("SAFS_FetchACL, Fid = %u.%u.%u, Host %s, Id %d\n",
Fid->Volume, Fid->Vnode, Fid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1, ("SAFS_FetchStatus, Fid = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(1, ("SAFS_FetchStatus, Fid = %u.%u.%u, Host %s, Id %d\n",
Fid->Volume, Fid->Vnode, Fid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
FS_LOCK
(opP->numOps)++;
FS_UNLOCK
- ViceLog(1, ("StoreData: Fid = %u.%d.%d\n",
+ ViceLog(1, ("StoreData: Fid = %u.%u.%u\n",
Fid->Volume, Fid->Vnode, Fid->Unique));
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(5, ("StoreData: Fid = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(5, ("StoreData: Fid = %u.%u.%u, Host %s, Id %d\n",
Fid->Volume, Fid->Vnode, Fid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1, ("SAFS_StoreACL, Fid = %u.%d.%d, ACL=%s, Host %s, Id %d\n",
+ ViceLog(1, ("SAFS_StoreACL, Fid = %u.%u.%u, ACL=%s, Host %s, Id %d\n",
Fid->Volume, Fid->Vnode, Fid->Unique, AccessList->AFSOpaque_val,
inet_ntoa(logHostAddr), t_client->ViceId));
FS_LOCK
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1, ("SAFS_StoreStatus, Fid = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(1, ("SAFS_StoreStatus, Fid = %u.%u.%u, Host %s, Id %d\n",
Fid->Volume, Fid->Vnode, Fid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
FS_LOCK
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1, ("SAFS_RemoveFile %s, Did = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(1, ("SAFS_RemoveFile %s, Did = %u.%u.%u, Host %s, Id %d\n",
Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
FS_LOCK
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1, ("SAFS_CreateFile %s, Did = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(1, ("SAFS_CreateFile %s, Did = %u.%u.%u, Host %s, Id %d\n",
Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
FS_LOCK
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1, ("SAFS_Rename %s to %s, Fid = %u.%d.%d to %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(1, ("SAFS_Rename %s to %s, Fid = %u.%u.%u to %u.%u.%u, Host %s, Id %d\n",
OldName, NewName, OldDirFid->Volume, OldDirFid->Vnode,
OldDirFid->Unique, NewDirFid->Volume, NewDirFid->Vnode,
NewDirFid->Unique,
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1, ("SAFS_Symlink %s to %s, Did = %u.%d.%d, Host %s, Id %d\n", Name,
+ ViceLog(1, ("SAFS_Symlink %s to %s, Did = %u.%u.%u, Host %s, Id %d\n", Name,
LinkContents, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
FS_LOCK
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1, ("SAFS_Link %s, Did = %u.%d.%d, Fid = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(1, ("SAFS_Link %s, Did = %u.%u.%u, Fid = %u.%u.%u, Host %s, Id %d\n",
Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
ExistingFid->Volume, ExistingFid->Vnode, ExistingFid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1, ("SAFS_MakeDir %s, Did = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(1, ("SAFS_MakeDir %s, Did = %u.%u.%u, Host %s, Id %d\n",
Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
FS_LOCK
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1, ("SAFS_RemoveDir %s, Did = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(1, ("SAFS_RemoveDir %s, Did = %u.%u.%u, Host %s, Id %d\n",
Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
FS_LOCK
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1,("SAFS_SetLock type = %s Fid = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(1,("SAFS_SetLock type = %s Fid = %u.%u.%u, Host %s, Id %d\n",
locktype[(int)type], Fid->Volume, Fid->Vnode, Fid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
FS_LOCK
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1,("SAFS_ExtendLock Fid = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(1,("SAFS_ExtendLock Fid = %u.%u.%u, Host %s, Id %d\n",
Fid->Volume, Fid->Vnode, Fid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
FS_LOCK
/* Get ptr to client data for user Id for logging */
t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon));
- ViceLog(1,("SAFS_ReleaseLock Fid = %u.%d.%d, Host %s, Id %d\n",
+ ViceLog(1,("SAFS_ReleaseLock Fid = %u.%u.%u, Host %s, Id %d\n",
Fid->Volume, Fid->Vnode, Fid->Unique,
inet_ntoa(logHostAddr), t_client->ViceId));
FS_LOCK
*Seconds = tpl.tv_sec;
*USeconds = tpl.tv_usec;
- ViceLog(2, ("SAFS_GetTime returns %d, %d\n", *Seconds, *USeconds));
+ ViceLog(2, ("SAFS_GetTime returns %u, %u\n", *Seconds, *USeconds));
Bad_GetTime:
code = CallPostamble(tcon, code);
if (Pos == -1 || VN_GET_INO(targetptr) == 0) {
/* the inode should have been created in Alloc_NewVnode */
logHostAddr.s_addr = rx_HostOf(rx_PeerOf(rx_ConnectionOf(Call)));
- ViceLog(0, ("StoreData_RXStyle : Inode non-existent Fid = %u.%d.%d, inode = %d, Pos %d Host %s\n",
- Fid->Volume, Fid->Vnode, Fid->Unique,
- VN_GET_INO(targetptr), Pos, inet_ntoa(logHostAddr) ));
+ ViceLog(0, ("StoreData_RXStyle : Inode non-existent Fid = %u.%u.%u, inode = %llu, Pos %d Host %s\n",
+ Fid->Volume, Fid->Vnode, Fid->Unique,
+ (afs_uintmax_t)VN_GET_INO(targetptr),
+ Pos, inet_ntoa(logHostAddr) ));
return ENOENT; /* is this proper error code? */
}
else {
{
if (ShowProblems) {
ViceLog(7,
- ("BCB: Failed on file %u.%d.%d, host %s:%d is down\n",
+ ("BCB: Failed on file %u.%u.%u, host %s:%d is down\n",
afidp->AFSCBFids_val->Volume, afidp->AFSCBFids_val->Vnode,
afidp->AFSCBFids_val->Unique, afs_inet_ntoa_r(hp->host,hoststr), ntohs(hp->port)));
}
int hostindex;
char hoststr[16];
- ViceLog(7,("BCB: BreakCallBack(all but %s:%d, (%u,%d,%d))\n",
+ ViceLog(7,("BCB: BreakCallBack(all but %s:%d, (%u,%u,%u))\n",
afs_inet_ntoa_r(xhost->host,hoststr), ntohs(xhost->port), fid->Volume, fid->Vnode,
fid->Unique));
if (!fe) {
h_Unlock_r(host);
H_UNLOCK
- ViceLog(8,("DCB: No call backs for fid (%u, %d, %d)\n",
+ ViceLog(8,("DCB: No call backs for fid (%u, %u, %u)\n",
fid->Volume, fid->Vnode, fid->Unique));
return 0;
}
pcb = FindCBPtr(fe, host);
if (!*pcb) {
- ViceLog(8,("DCB: No call back for host %s:%d, (%u, %d, %d)\n",
+ ViceLog(8,("DCB: No call back for host %s:%d, (%u, %u, %u)\n",
afs_inet_ntoa_r(host->host,hoststr), ntohs(host->port), fid->Volume, fid->Vnode, fid->Unique));
h_Unlock_r(host);
H_UNLOCK
struct host *host;
int found = 0;
- ViceLog(25, ("Setting later on volume %d\n", volume));
+ ViceLog(25, ("Setting later on volume %u\n", volume));
H_LOCK
for (hash=0; hash<VHASH; hash++) {
for (feip = &HashTable[hash]; fe = itofe(*feip); ) {
for (feip = &HashTable[hash]; fe = itofe(*feip); ) {
if (fe && (fe->status & FE_LATER) &&
(fid.Volume == 0 || fid.Volume == fe->volid)) {
- ViceLog(125, ("Unchaining for %d:%d:%d\n", fe->vnode,
+ ViceLog(125, ("Unchaining for %u:%u:%u\n", fe->vnode,
fe->unique, fe->volid));
fid.Volume = fe->volid;
*feip = fe->fnext;
}
if (tthead) {
- ViceLog(125, ("Breaking volume %d\n", fid.Volume));
+ ViceLog(125, ("Breaking volume %u\n", fid.Volume));
henumParms.ncbas = 0;
henumParms.fid = &fid;
henumParms.thead = tthead;
H_UNLOCK
return held;
}
- sprintf(tmpStr,"Host %s:%d down = %d, LastCall %s",
- afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
- (host->hostFlags & VENUSDOWN),
- afs_ctime((time_t *)&host->LastCall, tbuffer, sizeof(tbuffer)));
+ (void) afs_snprintf(tmpStr, sizeof tmpStr,
+ "Host %s:%d down = %d, LastCall %s",
+ afs_inet_ntoa_r(host->host, hoststr),
+ ntohs(host->port),
+ (host->hostFlags & VENUSDOWN),
+ afs_ctime((time_t *)&host->LastCall,
+ tbuffer, sizeof(tbuffer)));
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
for (client = host->FirstClient; client; client=client->next) {
if (!client->deleted) {
if (client->tcon) {
- sprintf(tmpStr, " user id=%d, name=%s, sl=%s till %s",
- client->ViceId, h_UserName(client),
- client->authClass ? "Authenticated" : "Not authenticated",
- client->authClass ?
- afs_ctime((time_t *)&client->expTime, tbuffer, sizeof(tbuffer))
- : "No Limit\n");
+ (void) afs_snprintf(tmpStr, sizeof tmpStr,
+ " user id=%d, name=%s, sl=%s till %s",
+ client->ViceId, h_UserName(client),
+ client->authClass ?
+ "Authenticated" : "Not authenticated",
+ client->authClass ?
+ afs_ctime((time_t *)&client->expTime, tbuffer, sizeof(tbuffer))
+ : "No Limit\n");
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
}
else {
- sprintf(tmpStr, " user=%s, no current server connection\n",
- h_UserName(client));
+ (void) afs_snprintf(tmpStr, sizeof tmpStr,
+ " user=%s, no current server connection\n",
+ h_UserName(client));
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
}
- sprintf(tmpStr, " CPS-%d is [", client->CPS.prlist_len);
+ (void) afs_snprintf(tmpStr, sizeof tmpStr,
+ " CPS-%d is [", client->CPS.prlist_len);
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
if (client->CPS.prlist_val) {
for (i=0; i > client->CPS.prlist_len; i++) {
- sprintf(tmpStr, " %d", client->CPS.prlist_val[i]);
+ (void) afs_snprintf(tmpStr, sizeof tmpStr,
+ " %d", client->CPS.prlist_val[i]);
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
}
}
return;
}
now = FT_ApproxTime();
- sprintf(tmpStr, "List of active users at %s\n",
- afs_ctime(&now, tbuffer, sizeof(tbuffer)));
+ (void) afs_snprintf(tmpStr, sizeof tmpStr,
+ "List of active users at %s\n",
+ afs_ctime(&now, tbuffer, sizeof(tbuffer)));
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
h_Enumerate(h_PrintClient, (char *)file);
STREAM_REALLYCLOSE(file);
char tmpStr[256];
H_LOCK
- sprintf(tmpStr, "ip:%x port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [",
- host->host, ntohs(host->port), host->index, host->cblist,
- CheckLock(&host->lock), host->LastCall, host->ActiveCall,
- (host->hostFlags & VENUSDOWN), host->hostFlags&HOSTDELETED,
- host->Console, host->hostFlags & CLIENTDELETED,
- host->hcpsfailed, host->cpsCall);
+ (void) afs_snprintf(tmpStr, sizeof tmpStr,
+ "ip:%x port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [",
+ host->host, ntohs(host->port), host->index, host->cblist,
+ CheckLock(&host->lock), host->LastCall, host->ActiveCall,
+ (host->hostFlags & VENUSDOWN), host->hostFlags&HOSTDELETED,
+ host->Console, host->hostFlags & CLIENTDELETED,
+ host->hcpsfailed, host->cpsCall);
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
if (host->hcps.prlist_val)
for (i=0; i < host->hcps.prlist_len; i++) {
- sprintf(tmpStr, " %d", host->hcps.prlist_val[i]);
+ (void) afs_snprintf(tmpStr, sizeof tmpStr,
+ " %d", host->hcps.prlist_val[i]);
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
}
sprintf(tmpStr, "] [");
return;
}
now = FT_ApproxTime();
- sprintf(tmpStr, "List of active hosts at %s\n",
+ (void) afs_snprintf(tmpStr, sizeof tmpStr, "List of active hosts at %s\n",
afs_ctime(&now, tbuffer, sizeof(tbuffer)));
STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
h_Enumerate(h_DumpHost, (char *) file);
${DEST}/include/afs/namei_ops.h
splint::
- for FILE in \
+ splint $(CFLAGS) \
vnode.c volume.c vutil.c partition.c fssync.c purge.c \
clone.c nuke.c devname.c listinodes.c common.c ihandle.c \
namei_ops.c \
- physio.c vol-salvage.c vol-info.c ; do \
- splint $(CFLAGS) $$FILE ; \
- done
+ physio.c vol-salvage.c vol-info.c
#include "partition.h"
#include "viceinode.h"
-/*@printfline@*/ extern void Log(const char *format, ...);
+/*@printflike@*/ extern void Log(const char *format, ...);
int (*vol_PollProc)() = 0; /* someone must init this */
clinode = 0; /* already cloned - don't delete later */
} else if (rwinode) {
if (IH_INC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) == -1) {
- Log("IH_INC failed: %x, %s, %d errno %d\n",
+ Log("IH_INC failed: %x, %s, %u errno %d\n",
V_linkHandle(rwvp), PrintInode(NULL, rwinode),
V_parentId(rwvp), errno);
assert(0);
/* Couldn't clone, go back and decrement the inode's link count */
if (inodeinced) {
if (IH_DEC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) == -1) {
- Log("IH_DEC failed: %x, %s, %d errno %d\n",
+ Log("IH_DEC failed: %x, %s, %u errno %d\n",
V_linkHandle(rwvp), PrintInode(NULL, rwinode),
V_parentId(rwvp), errno);
assert(0);
#endif
#ifndef AFS_NT40_ENV
- signal(SIGPIPE, SIG_IGN);
+ (void) signal(SIGPIPE, SIG_IGN);
#endif
#ifdef AFS_PTHREAD_ENV
int fd;
/* Create the inode directory if we're starting for the first time */
- sprintf(filename, "%s/%s", partition, INODEDIR);
+ (void) afs_snprintf(filename, sizeof filename,
+ "%s/%s", partition, INODEDIR);
mkdir(filename, 0700);
- sprintf(filename, "%s/%s/README", partition, INODEDIR);
+ (void) afs_snprintf(filename, sizeof filename,
+ "%s/%s/README", partition, INODEDIR);
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0444);
if (fd >= 0) {
(void) write(fd, VICE_README, strlen(VICE_README));
}
else {
/* Open this handle */
- (void) sprintf(path2, "%s/%s", path1, dp1->d_name);
+ (void) afs_snprintf(path2, sizeof path2,
+ "%s/%s", path1, dp1->d_name);
linkHandle.fd_fd = open(path2, O_RDONLY, 0666);
info.linkCount = namei_GetLinkCount(&linkHandle, (Inode)0, 0);
}
t_ih.ih_dev = h->ih_dev;
t_ih.ih_vid = h->ih_vid;
- sprintf(oldpath, "%s/%s", dir_name, infoName);
+ (void) afs_snprintf(oldpath, sizeof oldpath, "%s/%s", dir_name, infoName);
fd = open(oldpath, O_RDWR, 0);
if (fd < 0) {
Log("1 namei_ConvertROtoRWvolume: could not open RO info file: %s\n",
t_ih.ih_ino = namei_MakeSpecIno(h->ih_vid, VI_SMALLINDEX);
namei_HandleToName(&n, &t_ih);
- sprintf(newpath, "%s/%s", dir_name, smallName);
+ (void) afs_snprintf(newpath, sizeof newpath, "%s/%s", dir_name, smallName);
fd = open(newpath, O_RDWR, 0);
if (fd < 0) {
Log("1 namei_ConvertROtoRWvolume: could not open SmallIndex file: %s\n",
t_ih.ih_ino = namei_MakeSpecIno(h->ih_vid, VI_LARGEINDEX);
namei_HandleToName(&n, &t_ih);
- sprintf(newpath, "%s/%s", dir_name, largeName);
+ (void) afs_snprintf(newpath, sizeof newpath, "%s/%s", dir_name, largeName);
fd = open(newpath, O_RDWR, 0);
if (fd < 0) {
Log("1 namei_ConvertROtoRWvolume: could not open LargeIndex file: %s\n",
if (!s)
s = result;
- (void) sprintf((char*)s, "%Lu", ino);
+ (void) afs_snprintf(s, sizeof(afs_ino_str_t), "%llu", (afs_uintmax_t) ino);
- return (char*)s;
+ return s;
}
*/
/* reuse devName buffer now */
#ifdef AFS_NT40_ENV
- sprintf(devName, "%c:\\%s", *lastDevComp , VolumeExternalName(avolid));
+ afs_snprintf(devName, sizeof devName,
+ "%c:\\%s", *lastDevComp , VolumeExternalName(avolid));
#else
- sprintf(devName, "%s/%s", aname, VolumeExternalName(avolid));
+ afs_snprintf(devName, sizeof devName,
+ "%s/%s", aname, VolumeExternalName(avolid));
#endif /* AFS_NT40_ENV */
code = unlink(devName);
if (code) code = errno;
* volume header. This routine can, under some circumstances, be called
* when two volumes with the same id exist on different partitions.
*/
- sprintf(purgePath, "%s/%s", VPartitionPath(vp->partition),
- VolumeExternalName(V_id(vp)));
+ (void) afs_snprintf(purgePath, sizeof purgePath,
+ "%s/%s", VPartitionPath(vp->partition),
+ VolumeExternalName(V_id(vp)));
PurgeIndex_r(vp, vLarge);
PurgeIndex_r(vp, vSmall);
PurgeHeader_r(vp);
#endif /* AFS_NT40_ENV */
#include <sys/stat.h>
-extern void Abort(const char *format, ...);
+/*@printflike@*/ extern void Log(const char *format, ...);
+
+/*@printflike@*/ extern void Abort(const char *format, ...);
struct VnodeClassInfo VnodeClassInfo[nVNODECLASSES];
}
else if (FDH_SEEK(fdP, vnodeIndexOffset(vcp, vnodeNumber),
SEEK_SET) < 0) {
- Log ("VGetVnode: can't seek on index file vn=%d\n",vnodeNumber);
+ Log ("VGetVnode: can't seek on index file vn=%u\n",vnodeNumber);
*ec = VIO;
mlkReason=10;
FDH_REALLYCLOSE(fdP);
/* Check for disk errors. Anything else just means that the vnode
is not allocated */
if (n == -1 && errno == EIO) {
- Log("VGetVnode: Couldn't read vnode %d, volume %u (%s); volume needs salvage\n",
+ Log("VGetVnode: Couldn't read vnode %u, volume %u (%s); volume needs salvage\n",
vnodeNumber, V_id(vp), V_name(vp));
VForceOffline_r(vp);
*ec = VSALVAGE;
*ec = VNOVNODE;
}
else {
- Log("VGetVnode: Bad magic number, vnode %d, volume %u (%s); volume needs salvage\n",
+ Log("VGetVnode: Bad magic number, vnode %u, volume %u (%s); volume needs salvage\n",
vnodeNumber, V_id(vp), V_name(vp));
vp->goingOffline = 1; /* used to call VOffline, but that would mess
up the volume ref count if called here */
PrintInode(NULL, vp->vnodeIndex[class].handle->ih_ino));
*ec = VIO;
} else {
- Log("VPutVnode: Couldn't write vnode %d, volume %u (%s) (error %d)\n",
+ Log("VPutVnode: Couldn't write vnode %u, volume %u (%s) (error %d)\n",
vnp->vnodeNumber, V_id(vnp->volumePtr),
V_name(vnp->volumePtr), code);
VForceOffline_r(vp);
VOL_LOCK
if(code == BAD_IGET)
{
- Log("VPutVnode: bad inumber %d\n",
- vp->vnodeIndex[class].handle->ih_ino);
+ Log("VPutVnode: bad inumber %llu\n",
+ (afs_uintmax_t) vp->vnodeIndex[class].handle->ih_ino);
*ec = VIO;
} else {
- Log("VPutVnode: Couldn't write vnode %d, volume %u (%s)\n",
+ Log("VPutVnode: Couldn't write vnode %u, volume %u (%s)\n",
vnp->vnodeNumber, V_id(vnp->volumePtr),
V_name(vnp->volumePtr));
VForceOffline_r(vp);
if (!dsizeOnly && !saveinodes) {
printf("Volume header (size = %d):\n", size = stat.st_size);
printf("\tstamp\t= 0x%x\n", header.stamp.version);
- printf("\tVolId\t= %d\n", header.id);
+ printf("\tVolId\t= %u\n", header.id);
}
IH_INIT(ih, dp->device , header.id, header.volumeInfo);
IH_RELEASE(ih);
size += code;
if (!dsizeOnly && !saveinodes) {
- printf("\tparent\t= %d\n", header.parent);
+ printf("\tparent\t= %u\n", header.parent);
printf("\tInfo inode\t= %s (size = %d)\n",
PrintInode(NULL, header.volumeInfo), code);
}
if (saveinodes)
printf("Volume-Id\t Volsize Auxsize Inodesize AVolsize SizeDiff (VolName)\n");
- printf("%d\t%9d%9d%10d%10d%9d\t%24s\n",
+ printf("%u\t%9d%9d%10d%10d%9d\t%24s\n",
V_id(vp), Vdiskused, Vauxsize, Vvnodesize, totvolsize,
totvolsize-Vdiskused, V_name(vp));
}
FDH_REALLYCLOSE(fdP1);
IH_RELEASE(ih1);
close(ofd);
- printf("... Copied inode %d to file %s (%d bytes)\n",
- ino, nfile, total);
+ printf("... Copied inode %llu to file %s (%d bytes)\n",
+ (afs_uintmax_t)ino, nfile, total);
}
} else {
#if defined(AFS_NAMEI_ENV)
Vvnodesize += fileLength;
if (dsizeOnly) return;
if (orphaned && (fileLength ==0 || vnode->parent || !offset)) return;
- printf("%10d Vnode %u.%u.%u cloned: %d, length: %d linkCount: %d parent: %d",
- offset, vnodeNumber, vnode->uniquifier, vnode->dataVersion, vnode->cloned, fileLength, vnode->linkCount, vnode->parent);
+ printf("%10d Vnode %u.%u.%u cloned: %d, length: %llu linkCount: %d parent: %u",
+ offset, vnodeNumber, vnode->uniquifier, vnode->dataVersion, vnode->cloned, (afs_uintmax_t)fileLength, vnode->linkCount, vnode->parent);
if (DumpInodeNumber)
printf(" inode: %s", PrintInode(NULL, ino));
if (DumpDate)
} else
#endif
{
- sprintf(logFileName, "%s.%d", AFSDIR_SERVER_SLVGLOG_FILEPATH, jobs[startjob]->jobnumb);
+ (void) afs_snprintf(logFileName, sizeof logFileName, "%s.%d",
+ AFSDIR_SERVER_SLVGLOG_FILEPATH,
+ jobs[startjob]->jobnumb);
logFile = fopen(logFileName, "w");
}
if (!logFile) logFile = stdout;
#endif
if (!partP) {
for (i=0; i<jobcount; i++) {
- sprintf(logFileName, "%s.%d", AFSDIR_SERVER_SLVGLOG_FILEPATH, i);
+ (void) afs_snprintf(logFileName, sizeof logFileName, "%s.%d",
+ AFSDIR_SERVER_SLVGLOG_FILEPATH, i);
if ((passLog = fopen(logFileName, "r"))) {
while(fgets(buf, sizeof(buf), passLog)) {
fputs(buf, logFile);
(void) _putenv("TMP="); /* If "TMP" is set, then that overrides tdir. */
(void) strcpy(summaryFileName, _tempnam(tdir, "salvage.temp"));
#else
- sprintf(summaryFileName, "%s/salvage.temp.%d", tdir, getpid());
+ (void) afs_snprintf(summaryFileName, sizeof summaryFileName,
+ "%s/salvage.temp.%d", tdir, getpid());
#endif
summaryFile = fopen(summaryFileName, "a+");
if (summaryFile == NULL) {
#endif
if (ip->linkCount != 0 && TraceBadLinkCounts) {
TraceBadLinkCounts--; /* Limit reports, per volume */
- Log("#### DEBUG #### Link count incorrect by %d; inode %s, size %u, p=(%u,%u,%u,%u)\n",
+ Log("#### DEBUG #### Link count incorrect by %d; inode %s, size %llu, p=(%u,%u,%u,%u)\n",
ip->linkCount, PrintInode(NULL, ip->inodeNumber),
- ip->byteCount, ip->u.param[0], ip->u.param[1],
+ (afs_uintmax_t) ip->byteCount,
+ ip->u.param[0], ip->u.param[1],
ip->u.param[2], ip->u.param[3]);
}
while (ip->linkCount > 0) {
if (isp->volSummary == NULL) {
char name[64];
- sprintf(name, VFORMAT, isp->volumeId);
+ (void) afs_snprintf(name, sizeof name, VFORMAT, isp->volumeId);
if (check) {
Log("No header file for volume %u\n", isp->volumeId);
return -1;
if (isp->volSummary->fileName) {
strcpy(name, isp->volSummary->fileName);
} else {
- sprintf(name, VFORMAT, isp->volumeId);
+ (void) afs_snprintf(name, sizeof name, VFORMAT, isp->volumeId);
isp->volSummary->fileName = ToString(name);
}
goto zooks;
}
if (!Showmode) {
- Log("Vnode %d: inode number incorrect; changed from %s to %s. FileSize=%d\n",
+ Log("Vnode %d: inode number incorrect; changed from %s to %s. FileSize=%llu\n",
vnodeNumber,
PrintInode(stmp1, VNDISK_GET_INO(vnode)),
PrintInode(stmp2, ip->inodeNumber),
- ip->byteCount);
+ (afs_uintmax_t)ip->byteCount);
}
VNDISK_SET_INO(vnode, ip->inodeNumber);
vnodeChanged = 1;
VNDISK_GET_LEN(vnodeLength, vnode);
if (ip->byteCount != vnodeLength) {
if (check) {
- if (!Showmode) Log("Vnode %d: length incorrect; (is %d should be %d)\n",
- vnodeNumber, vnodeLength, ip->byteCount);
+ if (!Showmode) Log("Vnode %d: length incorrect; (is %llu should be %llu)\n",
+ vnodeNumber,
+ (afs_uintmax_t)vnodeLength,
+ (afs_uintmax_t)ip->byteCount);
err = -1;
goto zooks;
}
- if (!Showmode) Log("Vnode %d: length incorrect; changed from %d to %d\n",
- vnodeNumber, vnodeLength, ip->byteCount);
+ if (!Showmode) Log("Vnode %d: length incorrect; changed from %llu to %llu\n",
+ vnodeNumber,
+ (afs_uintmax_t)vnodeLength,
+ (afs_uintmax_t)ip->byteCount);
VNDISK_SET_LEN(vnode, ip->byteCount);
vnodeChanged = 1;
}
vnodeEssence = CheckVnodeNumber(vnodeNumber);
if (vnodeEssence == NULL) {
if (!Showmode) {
- Log("dir vnode %d: invalid entry deleted: %s/%s (vnode %d, unique %d)\n",
+ Log("dir vnode %u: invalid entry deleted: %s/%s (vnode %u, unique %u)\n",
dir->vnodeNumber, dir->name?dir->name:"??",
name, vnodeNumber, unique);
}
if (!(vnodeNumber & 1) && !Showmode &&
!(vnodeEssence->count || vnodeEssence->unique || vnodeEssence->modeBits)) {
- Log("dir vnode %d: invalid entry: %s/%s (vnode %d, unique %d)%s\n",
+ Log("dir vnode %u: invalid entry: %s/%s (vnode %u, unique %u)%s\n",
dir->vnodeNumber, (dir->name?dir->name:"??"),
name, vnodeNumber, unique,
((!unique)?(Testing?"-- would have deleted":" -- deleted"):""));
todelete = ((!vnodeEssence->unique || dirOrphaned) ? 1 : 0);
if (!Showmode) {
- Log("dir vnode %d: %s/%s (vnode %d): unique changed from %d to %d %s\n",
+ Log("dir vnode %u: %s/%s (vnode %u): unique changed from %u to %u %s\n",
dir->vnodeNumber, (dir->name ? dir->name : "??"),
name, vnodeNumber, unique, vnodeEssence->unique,
(!todelete?"":(Testing?"-- would have deleted":"-- deleted")));
if (strcmp(name,".") == 0) {
if (dir->vnodeNumber != vnodeNumber || (dir->unique != unique)) {
ViceFid fid;
- if (!Showmode) Log("directory vnode %d.%d: bad '.' entry (was %d.%d); fixed\n",
+ if (!Showmode) Log("directory vnode %u.%u: bad '.' entry (was %u.%u); fixed\n",
dir->vnodeNumber, dir->unique, vnodeNumber, unique);
if (!Testing) {
CopyOnWrite(dir);
pa.Unique = dir->unique;
}
if ((pa.Vnode != vnodeNumber) || (pa.Unique != unique)) {
- if (!Showmode) Log("directory vnode %d.%d: bad '..' entry (was %d.%d); fixed\n",
+ if (!Showmode) Log("directory vnode %u.%u: bad '..' entry (was %u.%u); fixed\n",
dir->vnodeNumber, dir->unique, vnodeNumber, unique);
if (!Testing) {
CopyOnWrite(dir);
dir->haveDotDot = 1;
} else if (strncmp(name,".__afs",6) == 0) {
if (!Showmode) {
- Log("dir vnode %d: special old unlink-while-referenced file %s %s deleted (vnode %d)\n",
+ Log("dir vnode %u: special old unlink-while-referenced file %s %s deleted (vnode %u)\n",
dir->vnodeNumber, name, (Testing?"would have been":"is"), vnodeNumber);
}
if (!Testing) {
if (vnodeIdToClass(vnodeNumber) == vLarge &&
vnodeEssence->name == NULL) {
char *n;
- if (n = (char*)malloc(strlen(name)+1))
+ if ((n = (char*)malloc(strlen(name)+1)))
strcpy(n, name);
vnodeEssence->name = n;
}
* another non-orphaned dir).
*/
if (!Showmode) {
- Log("dir vnode %d: %s/%s (vnode %d, unique %d) -- parent vnode %schanged from %d to %d\n",
+ Log("dir vnode %u: %s/%s (vnode %u, unique %u) -- parent vnode %schanged from %u to %u\n",
dir->vnodeNumber, (dir->name ? dir->name : "??"), name,
vnodeNumber, unique, (Testing?"would have been ":""),
vnodeEssence->parent, dir->vnodeNumber);
/* Vnode was claimed by another directory */
if (!Showmode) {
if (dirOrphaned) {
- Log("dir vnode %d: %s/%s parent vnode is %d (vnode %d, unique %d) -- %sdeleted\n",
+ Log("dir vnode %u: %s/%s parent vnode is %u (vnode %u, unique %u) -- %sdeleted\n",
dir->vnodeNumber, (dir->name ? dir->name : "??"), name,
vnodeEssence->parent, vnodeNumber, unique,
(Testing?"would have been ":""));
} else {
- Log("dir vnode %d: %s/%s already claimed by directory vnode %d (vnode %d, unique %d) -- %sdeleted\n",
+ Log("dir vnode %u: %s/%s already claimed by directory vnode %u (vnode %u, unique %u) -- %sdeleted\n",
dir->vnodeNumber, (dir->name ? dir->name : "??"), name,
vnodeEssence->parent, vnodeNumber, unique,
(Testing?"would have been ":""));
dirok = ((RebuildDirs && !Testing) ? 0 : DirOK(&dir.dirHandle));
if (!dirok) {
if (!RebuildDirs) {
- Log("Directory bad, vnode %d; %s...\n",
+ Log("Directory bad, vnode %u; %s...\n",
dir.vnodeNumber, (Testing ? "skipping" : "salvaging"));
}
if (!Testing) {
pa.Vnode = ThisVnode;
pa.Unique = ThisUnique;
- sprintf(npath, "%s.%d.%d",
+ (void) afs_snprintf(npath, sizeof npath, "%s.%u.%u",
((class == vLarge)?"__ORPHANDIR__":"__ORPHANFILE__"),
ThisVnode, ThisUnique);
}
} else if (vnp->count) {
if (!Showmode) {
- Log("Vnode %d: link count incorrect (was %d, %s %d)\n",
+ Log("Vnode %u: link count incorrect (was %d, %s %d)\n",
vnodeNumber, oldCount,
(Testing?"would have changed to":"now"), vnode.linkCount);
}
nInodes = status.st_size / sizeof(struct ViceInodeInfo);
assert(read(inodeFd, buf, status.st_size) == status.st_size);
for(ip = buf; nInodes--; ip++) {
- Log("Inode:%s, linkCount=%d, size=%u, p=(%u,%u,%u,%u)\n",
- PrintInode(NULL, ip->inodeNumber), ip->linkCount, ip->byteCount,
+ Log("Inode:%s, linkCount=%d, size=%#llx, p=(%u,%u,%u,%u)\n",
+ PrintInode(NULL, ip->inodeNumber), ip->linkCount,
+ (afs_uintmax_t) ip->byteCount,
ip->u.param[0], ip->u.param[1], ip->u.param[2], ip->u.param[3]);
}
free(buf);
now = time(0);
lt = localtime(&now);
- sprintf(stampSlvgLog, "%s.%04d-%02d-%02d.%02d:%02d:%02d",
- AFSDIR_SERVER_SLVGLOG_FILEPATH,
- lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday,
- lt->tm_hour, lt->tm_min, lt->tm_sec);
+ (void) afs_snprintf(stampSlvgLog, sizeof stampSlvgLog,
+ "%s.%04d-%02d-%02d.%02d:%02d:%02d",
+ AFSDIR_SERVER_SLVGLOG_FILEPATH,
+ lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday,
+ lt->tm_hour, lt->tm_min, lt->tm_sec);
/* try to link the logfile to a timestamped filename */
/* if it fails, oh well, nothing we can do */
void Log(const char *format, ...)
{
struct timeval now;
+ char tmp[1024];
va_list args;
va_start(args, format);
+ (void) afs_vsnprintf(tmp, sizeof tmp, format, args);
+ va_end(args);
#ifndef AFS_NT40_ENV
if ( useSyslog )
{
- char tmp[1024];
- (void) vsnprintf(tmp, sizeof tmp, format, args);
syslog(LOG_INFO, "%s", tmp);
} else
#endif
{
gettimeofday(&now, 0);
- fprintf(logFile, "%s ", TimeStamp(now.tv_sec, 1));
- vfprintf(logFile, format, args);
+ fprintf(logFile, "%s %s", TimeStamp(now.tv_sec, 1), tmp);
fflush(logFile);
}
- va_end(args);
}
void Abort(const char *format, ...)
{
va_list args;
+ char tmp[1024];
va_start(args, format);
+ (void) afs_vsnprintf(tmp, sizeof tmp, format, args);
+ va_end(args);
#ifndef AFS_NT40_ENV
if ( useSyslog )
{
- char tmp[1024];
- (void) vsnprintf(tmp, sizeof tmp, format, args);
syslog(LOG_INFO, "%s", tmp);
} else
#endif
{
- vfprintf(logFile, format, args);
+ fprintf(logFile, "%s", tmp);
fflush(logFile);
if (ShowLog) showlog();
}
- va_end(args);
if (debug)
abort();
#include "lwp.h"
#include <afs/afssyscalls.h>
#include "ihandle.h"
-#ifdef AFS_NT40_ENV
#include <afs/afsutil.h>
+#ifdef AFS_NT40_ENV
#include <io.h>
#endif
#include "vnode.h"
V_VOLUPD);
(*(vp?&nAttached:&nUnattached))++;
if (error == VOFFLINE)
- Log("Volume %u stays offline (/vice/offline/%s exists)\n",
+ Log("Volume %d stays offline (/vice/offline/%s exists)\n",
VolumeNumber(dp->d_name), dp->d_name);
else
- Log("Partition %s: attached volume %u (%s)\n", diskP->name,
+ Log("Partition %s: attached volume %d (%s)\n", diskP->name,
VolumeNumber(dp->d_name), dp->d_name);
if (vp) {
VPutVolume(vp);
VOLUMEINFOMAGIC, VOLUMEINFOVERSION);
VOL_LOCK
if (*ec) {
- Log("VAttachVolume: Error reading diskDataHandle vol header %s; error=%d\n",
+ Log("VAttachVolume: Error reading diskDataHandle vol header %s; error=%u\n",
path, *ec);
}
if (!*ec) {
SMALLINDEXMAGIC, SMALLINDEXVERSION);
VOL_LOCK
if (*ec) {
- Log("VAttachVolume: Error reading smallVnode vol header %s; error=%d\n",
+ Log("VAttachVolume: Error reading smallVnode vol header %s; error=%u\n",
path, *ec);
}
}
LARGEINDEXMAGIC, LARGEINDEXVERSION);
VOL_LOCK
if (*ec) {
- Log("VAttachVolume: Error reading largeVnode vol header %s; error=%d\n",
+ Log("VAttachVolume: Error reading largeVnode vol header %s; error=%u\n",
path, *ec);
}
}
LINKTABLEMAGIC, LINKTABLEVERSION);
VOL_LOCK
if (*ec) {
- Log("VAttachVolume: Error reading namei vol header %s; error=%d\n",
+ Log("VAttachVolume: Error reading namei vol header %s; error=%u\n",
path, *ec);
}
}
#endif
if (*ec) {
- Log("VAttachVolume: Error attaching volume %s; volume needs salvage; error=%d\n",
+ Log("VAttachVolume: Error attaching volume %s; volume needs salvage; error=%u\n",
path, *ec);
FreeVolume(vp);
return NULL;
#include "lwp.h"
#include <afs/afssyscalls.h>
#include "ihandle.h"
+#include <afs/afsutil.h>
#ifdef AFS_NT40_ENV
#include "ntops.h"
#include <io.h>
#include <strings.h>
#endif
+
/*@printflike@*/ extern void Log(const char *format, ...);
void AssignVolumeName();
vol.stamp.magic = VOLUMEINFOMAGIC;
vol.stamp.version = VOLUMEINFOVERSION;
vol.destroyMe = DESTROY_ME;
- sprintf(headerName, VFORMAT, vol.id);
- sprintf(volumePath, "%s/%s", VPartitionPath(partition), headerName);
+ (void) afs_snprintf(headerName, sizeof headerName, VFORMAT, vol.id);
+ (void) afs_snprintf(volumePath, sizeof volumePath,
+ "%s/%s", VPartitionPath(partition), headerName);
fd = open(volumePath, O_CREAT|O_EXCL|O_WRONLY, 0600);
if (fd == -1) {
if (errno == EEXIST) {
IH_INIT(handle, device, vol.parentId, tempHeader.volumeInfo);
fdP = IH_OPEN(handle);
if (fdP == NULL) {
- Log("VCreateVolume: Problem iopen inode %d (err=%d)\n", tempHeader.volumeInfo, errno);
+ Log("VCreateVolume: Problem iopen inode %llu (err=%d)\n",
+ (afs_uintmax_t)tempHeader.volumeInfo, errno);
unlink(volumePath);
goto bad;
}
if (FDH_SEEK(fdP, 0, SEEK_SET) < 0) {
- Log("VCreateVolume: Problem lseek inode %d (err=%d)\n", tempHeader.volumeInfo, errno);
+ Log("VCreateVolume: Problem lseek inode %llu (err=%d)\n",
+ (afs_uintmax_t)tempHeader.volumeInfo, errno);
FDH_REALLYCLOSE(fdP);
unlink(volumePath);
goto bad;
}
if (FDH_WRITE(fdP, (char*)&vol, sizeof(vol)) != sizeof(vol)) {
- Log("VCreateVolume: Problem writing to inode %d (err=%d)\n", tempHeader.volumeInfo, errno);
+ Log("VCreateVolume: Problem writing to inode %llu (err=%d)\n",
+ (afs_uintmax_t)tempHeader.volumeInfo, errno);
FDH_REALLYCLOSE(fdP);
unlink(volumePath);
goto bad;
splint::
splint $(CFLAGS) \
- vos.c \
+ vos.c restorevol.c \
vsprocs.c vsutils.c lockprocs.c volerr.c \
- volmain.c volprocs.c physio.c common.c voltrans.c volerr.c \
+ volmain.c volprocs.c physio.c common.c voltrans.c \
dumpstuff.c
IH_INIT(ihP, iodp->device, iodp->parentId, VNDISK_GET_INO(v));
fdP = IH_OPEN(ihP);
if (fdP == NULL) {
- Log("1 Volser: DumpVnode: dump: Unable to open inode %d for vnode %d (volume %d); not dumped, error %d\n",
- VNDISK_GET_INO(v), vnodeNumber, volid, errno);
+ Log("1 Volser: DumpVnode: dump: Unable to open inode %llu for vnode %u (volume %i); not dumped, error %d\n",
+ (afs_uintmax_t)VNDISK_GET_INO(v), vnodeNumber, volid, errno);
IH_RELEASE(ihP);
return VOLSERREAD_DUMPERROR;
}
cnt1++;
if (DoLogging) {
afs_fsize_t vnodeLength;
- Log("RestoreVolume %d Cleanup: Removing old vnode=%d inode=%d size=%d\n",
+ Log("RestoreVolume %u Cleanup: Removing old vnode=%u inode=%llu size=%llu\n",
V_id(vp), bitNumberToVnodeNumber(i,class),
- VNDISK_GET_INO(vnode), vnodeLength);
+ (afs_uintmax_t)VNDISK_GET_INO(vnode),
+ (afs_uintmax_t)vnodeLength);
}
IH_DEC(V_linkHandle(vp), VNDISK_GET_INO(vnode),
V_parentId(vp));
FDH_REALLYCLOSE(fdP);
IH_RELEASE(tmpH);
if (error) {
- Log("1 Volser: ReadVnodes: IDEC inode %d\n", ino);
+ Log("1 Volser: ReadVnodes: IDEC inode %llu\n",
+ (afs_uintmax_t)ino);
IH_DEC(V_linkHandle(vp), ino, V_parentId(vp));
return VOLSERREAD_DUMPERROR;
}
size = nbytes;
if ((code = iod_Read(iodp, p, size)) != size) {
- Log("1 Volser: WriteFile: Error reading dump file %d size=%d nbytes=%d (%d of %d); restore aborted\n", vn, filesize, nbytes, code, size);
+ Log("1 Volser: WriteFile: Error reading dump file %d size=%llu nbytes=%u (%d of %u); restore aborted\n", vn, (afs_uintmax_t)filesize, nbytes, code, size);
*status = 3;
break;
}
*/
vnode = ((vn.type == 2) ? vn.vnode : vn.parent);
if (vnode == 1)
- sprintf(parentdir, "%s", rootdir);
+ strncpy(parentdir, rootdir, sizeof parentdir);
else {
- sprintf(parentdir, "%s/%s%d", rootdir, ADIR, vnode);
+ afs_snprintf(parentdir, sizeof parentdir,
+ "%s/%s%d", rootdir, ADIR, vnode);
len = readlink(parentdir, linkname, MAXNAMELEN);
if (len < 0) {
/* parentdir does not exist. So create an orphan dir.
* and then link the parentdir to the orphaned dir.
*/
- sprintf(linkname, "%s/%s%d", rootdir, ODIR, vnode);
+ afs_snprintf(linkname, sizeof linkname,
+ "%s/%s%d", rootdir, ODIR, vnode);
code = mkdir(linkname, 0777);
if ((code < 0) && (errno != EEXIST)) {
fprintf(stderr, "Error creating directory %s code=%d;%d\n",
}
/* Link the parentdir to it - now parentdir exists */
- sprintf(linkname, "%s%d/", ODIR, vnode);
+ afs_snprintf(linkname, sizeof linkname,
+ "%s%d/", ODIR, vnode);
code = symlink(linkname, parentdir);
if (code) {
fprintf(stderr, "Error creating symlink %s -> %s code=%d;%d\n",
/* dirname is the directory to create.
* vflink is what will link to it.
*/
- sprintf(dirname, "%s/%s", parentdir, this_name);
- sprintf(vflink, "%s/%s%d", rootdir, ADIR, this_vn);
+ afs_snprintf(dirname, sizeof dirname,
+ "%s/%s", parentdir, this_name);
+ afs_snprintf(vflink, sizeof vflink,
+ "%s/%s%d", rootdir, ADIR, this_vn);
/* The link and directory may already exist */
len = readlink(vflink, linkname, MAXNAMELEN);
* It was created originally as orphaned.
*/
linkname[len-1] = '\0'; /* remove '/' at end */
- sprintf(lname, "%s/%s", rootdir, linkname);
+ afs_snprintf(lname, sizeof lname,
+ "%s/%s", rootdir, linkname);
code = rename(lname, dirname);
if (code) {
fprintf(stderr, "Error renaming %s to %s code=%d;%d\n",
/* Now create/update the link to the new/moved directory */
if (vn.vnode == 1)
- sprintf(dirname, "%s/", this_name);
+ afs_snprintf(dirname, sizeof dirname,
+ "%s/", this_name);
else
- sprintf(dirname, "%s%d/%s/", ADIR, vn.vnode, this_name);
+ afs_snprintf(dirname, sizeof dirname,
+ "%s%d/%s/", ADIR, vn.vnode, this_name);
unlink(vflink);
code = symlink(dirname, vflink);
if (code) {
*/
else {
/*AFILEENTRY*/
- sprintf(vflink, "%s/%s%d", parentdir, AFILE, this_vn);
+ afs_snprintf(vflink, sizeof vflink,
+ "%s/%s%d", parentdir, AFILE, this_vn);
code = symlink(this_name, vflink);
if ((code < 0) && (errno != EEXIST)) {
* then the file will be an orphaned file.
*/
lfile = 1;
- sprintf(filename, "%s/%s%d", parentdir, AFILE, vn.vnode);
+ afs_snprintf(filename, sizeof filename,
+ "%s/%s%d", parentdir, AFILE, vn.vnode);
len = readlink(filename, fname, MAXNAMELEN);
if (len < 0) {
- sprintf(filename, "%s/%s%d", rootdir, OFILE, vn.vnode);
+ afs_snprintf(filename, sizeof filename,
+ "%s/%s%d", rootdir, OFILE, vn.vnode);
lfile = 0; /* no longer a linked file; a direct path */
}
s = ((size > BUFSIZE) ? BUFSIZE : size);
code = fread(buf, 1, s, dumpfile);
if (code > 0) {
- write(fid, buf, code);
+ (void) write(fid, buf, code);
size -= code;
}
if (code != s) {
if (code < 0)
fprintf (stderr, "Code = %d; Errno = %d\n", code, errno);
- else
- fprintf (stderr, "Read %d bytes out of %d\n",
- (vn.dataSize - size), vn.dataSize);
+ else {
+ char tmp[100];
+ (void) afs_snprintf(tmp, sizeof tmp,
+ "Read %llu bytes out of %llu",
+ (afs_uintmax_t)(vn.dataSize - size),
+ (afs_uintmax_t)vn.dataSize);
+ fprintf (stderr, "%s\n", tmp);
+ }
break;
}
}
* of the symbolic link. If it doesn't exist,
* then the link will be an orphaned link.
*/
- sprintf(linkname, "%s/%s%d", parentdir, AFILE, vn.vnode);
+ afs_snprintf(linkname, sizeof linkname,
+ "%s/%s%d", parentdir, AFILE, vn.vnode);
len = readlink(linkname, fname, MAXNAMELEN);
if (len < 0) {
- sprintf(filename, "%s/%s%d", rootdir, OFILE, vn.vnode);
+ afs_snprintf(filename, sizeof filename,
+ "%s/%s%d", rootdir, OFILE, vn.vnode);
} else {
fname[len] = '\0';
- sprintf(filename, "%s/%s", parentdir, fname);
+ afs_snprintf(filename, sizeof filename,
+ "%s/%s", parentdir, fname);
}
/* Read the link in, delete it, and then create it */
code = chdir((as->parms[3].items ? as->parms[3].items->data :
as->parms[1].items->data));
if (code) {
- fprintf(stderr, "Mount point directory not found: Error = %d\n", stderr);
+ fprintf(stderr, "Mount point directory not found: Error = %d\n", errno);
goto cleanup;
}
t = (char *)getcwd(mntroot, MAXPATHLEN); /* get its full pathname */
goto cleanup;
}
strcat(mntroot, "/"); /* append '/' to end of it */
- chdir(thisdir); /* return to original working dir */
+ code = chdir(thisdir); /* return to original working dir */
if (code) {
- fprintf(stderr, "Cannot find working directory: Error = %d\n", stderr);
+ fprintf(stderr, "Cannot find working directory: Error = %d\n", errno);
goto cleanup;
}
} else { /* use current directory */
dirP = opendir(rootdir);
while (dirP && (dirE = readdir(dirP))) {
if (strncmp(dirE->d_name, ADIR, strlen(ADIR)) == 0) {
- sprintf(name, "%s/%s", rootdir, dirE->d_name);
+ afs_snprintf(name, sizeof name, "%s/%s", rootdir, dirE->d_name);
dirQ = opendir(name);
while (dirQ && (dirF = readdir(dirQ))) {
if (strncmp(dirF->d_name, AFILE, strlen(AFILE)) == 0) {
- sprintf(name, "%s/%s/%s", rootdir, dirE->d_name, dirF->d_name);
+ afs_snprintf(name, sizeof name,
+ "%s/%s/%s", rootdir, dirE->d_name, dirF->d_name);
unlink(name);
}
}
closedir(dirQ);
} else if (strncmp(dirE->d_name, AFILE, strlen(AFILE)) == 0) {
- sprintf(name, "%s/%s", rootdir, dirE->d_name);
+ afs_snprintf(name, sizeof name, "%s/%s", rootdir, dirE->d_name);
unlink(name);
}
}
dirP = opendir(rootdir);
while (dirP && (dirE = readdir(dirP))) {
if (strncmp(dirE->d_name, ADIR, strlen(ADIR)) == 0) {
- sprintf(name, "%s/%s", rootdir, dirE->d_name);
+ afs_snprintf(name, sizeof name, "%s/%s", rootdir, dirE->d_name);
unlink(name);
}
}
afs_int32 asize; {
if (asize < 18) return -1;
/* It's better using the Generic VFORMAT since otherwise we have to make changes to too many places... The 14 char limitation in names hits us again in AIX; print in field of 9 digits (still 10 for the rest), right justified with 0 padding */
- sprintf(aname, VFORMAT, (unsigned long) avol);
+ (void) afs_snprintf(aname, asize, VFORMAT, (unsigned long) avol);
return 0;
}
CloneVolume(&error, originalvp, newvp, purgevp);
purgevp = NULL; /* clone releases it, maybe even if error */
if (error) {
- Log("1 Volser: Clone: clone operation failed with code %d\n", error);
+ Log("1 Volser: Clone: clone operation failed with code %u\n", error);
LogError(error);
goto fail;
}
V_inUse(newvp) = 0;
VUpdateVolume(&error, newvp);
if (error) {
- Log("1 Volser: Clone: VUpdate failed code %d\n", error);
+ Log("1 Volser: Clone: VUpdate failed code %u\n", error);
LogError(error);
goto fail;
}
newvp = NULL;
VUpdateVolume(&error, originalvp);
if (error) {
- Log("1 Volser: Clone: original update %d\n", error);
+ Log("1 Volser: Clone: original update %u\n", error);
LogError(error);
goto fail;
}
V_inUse(clonevp) = 0;
VUpdateVolume(&error, clonevp);
if (error) {
- Log("1 Volser: Clone: VUpdate failed code %d\n", error);
+ Log("1 Volser: Clone: VUpdate failed code %u\n", error);
LogError(error);
goto fail;
}
clonevp = NULL;
VUpdateVolume(&error, originalvp);
if (error) {
- Log("1 Volser: Clone: original update %d\n", error);
+ Log("1 Volser: Clone: original update %u\n", error);
LogError(error);
goto fail;
}
}
}
if (!found) return ENOENT;
- sprintf(headername, VFORMAT, volumeId);
- sprintf(opath,"%s/%s", pname, headername);
+ (void) afs_snprintf(headername, sizeof headername, VFORMAT, volumeId);
+ (void) afs_snprintf(opath, sizeof opath,"%s/%s", pname, headername);
fd = open(opath, O_RDONLY);
if (fd < 0) {
Log("1 SAFS_VolConvertROtoRWvolume: Couldn't open header for RO-volume %lu.\n", volumeId);
h.smallVnodeIndex_hi = h.id;
h.largeVnodeIndex_hi = h.id;
h.linkTable_hi = h.id;
- sprintf(headername, VFORMAT, h.id);
- sprintf(npath, "%s/%s", pname, headername);
+ (void) afs_snprintf(headername, sizeof headername, VFORMAT, h.id);
+ (void) afs_snprintf(npath, sizeof npath, "%s/%s", pname, headername);
fd = open(npath, O_CREAT | O_EXCL | O_RDWR, 0644);
if (fd < 0) {
Log("1 SAFS_VolConvertROtoRWvolume: Couldn't create header for RW-volume %lu.\n", h.id);
fflush(STDOUT);
interrupt=1;
- signal(SIGINT,sigint_handler);
+ (void) signal(SIGINT,sigint_handler);
return;
}