Fixes to compile on CentOS 8 - thanks to Torsten for providing this patch
This commit is contained in:
parent
7685f64dc1
commit
564b39b884
@ -18,16 +18,17 @@ char *units(double size) {
|
|||||||
int div = 0;
|
int div = 0;
|
||||||
double rem = 0;
|
double rem = 0;
|
||||||
int base = 1024;
|
int base = 1024;
|
||||||
|
int s_size = 128;
|
||||||
|
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
s = "\0";
|
s = "\0";
|
||||||
s = malloc(128);
|
s = malloc(s_size);
|
||||||
if (s==NULL) {
|
if (s==NULL) {
|
||||||
perror("Arg, out of memory?");
|
perror("Arg, out of memory?");
|
||||||
exit(255);
|
exit(255);
|
||||||
}
|
}
|
||||||
memset(s,0x00,(sizeof s));
|
memset(s,0x00,s_size);
|
||||||
|
|
||||||
while (size >= base && div < (int)(sizeof SIZES / sizeof *SIZES)-1) {
|
while (size >= base && div < (int)(sizeof SIZES / sizeof *SIZES)-1) {
|
||||||
if (verbose > 2)
|
if (verbose > 2)
|
||||||
|
@ -72,14 +72,16 @@ dsmDate dsmStrToDate(char *s) {
|
|||||||
char *dsmDateToStr(dsmDate date) {
|
char *dsmDateToStr(dsmDate date) {
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
s = malloc(19);
|
int s_size = 32;
|
||||||
|
|
||||||
|
s = malloc(s_size);
|
||||||
|
|
||||||
if (s==NULL) {
|
if (s==NULL) {
|
||||||
perror("Arg, out of memory?");
|
perror("Arg, out of memory?");
|
||||||
exit(255);
|
exit(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(s,0x00,(sizeof s));
|
memset(s,0x00,s_size);
|
||||||
|
|
||||||
sprintf(s,"%04i-%02i-%02i %02i:%02i:%02i",
|
sprintf(s,"%04i-%02i-%02i %02i:%02i:%02i",
|
||||||
date.year,
|
date.year,
|
||||||
@ -145,7 +147,7 @@ char *dsmObjnameToStr(dsmObjName objName) {
|
|||||||
exit(255);
|
exit(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(s,0x00,(sizeof s));
|
memset(s,0x00,sizeof(dsmObjName));
|
||||||
|
|
||||||
sprintf(s,"%s%s%s",objName.fs,objName.hl,objName.ll);
|
sprintf(s,"%s%s%s",objName.fs,objName.hl,objName.ll);
|
||||||
|
|
||||||
|
@ -133,10 +133,11 @@ double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long lon
|
|||||||
|
|
||||||
#ifdef USE_DIGEST
|
#ifdef USE_DIGEST
|
||||||
char digest_str[EVP_MAX_MD_SIZE*2];
|
char digest_str[EVP_MAX_MD_SIZE*2];
|
||||||
EVP_MD_CTX mdctx;
|
EVP_MD_CTX *mdctx;
|
||||||
const EVP_MD *md=NULL;
|
const EVP_MD *md=NULL;
|
||||||
unsigned char md_value[EVP_MAX_MD_SIZE];
|
unsigned char md_value[EVP_MAX_MD_SIZE];
|
||||||
unsigned int md_len, i;
|
unsigned int md_len, i;
|
||||||
|
mdctx = NULL;
|
||||||
|
|
||||||
if (digest) {
|
if (digest) {
|
||||||
OpenSSL_add_all_digests();
|
OpenSSL_add_all_digests();
|
||||||
@ -229,8 +230,8 @@ double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long lon
|
|||||||
|
|
||||||
#ifdef USE_DIGEST
|
#ifdef USE_DIGEST
|
||||||
if (digest) {
|
if (digest) {
|
||||||
EVP_MD_CTX_init(&mdctx);
|
mdctx = EVP_MD_CTX_new();
|
||||||
EVP_DigestInit_ex(&mdctx, md, NULL);
|
EVP_DigestInit_ex(mdctx, md, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -250,7 +251,7 @@ double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long lon
|
|||||||
|
|
||||||
#ifdef USE_DIGEST
|
#ifdef USE_DIGEST
|
||||||
if (digest)
|
if (digest)
|
||||||
EVP_DigestUpdate(&mdctx, buffer, nbytes);
|
EVP_DigestUpdate(mdctx, buffer, nbytes);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dataBlk.bufferLen = nbytes;
|
dataBlk.bufferLen = nbytes;
|
||||||
@ -289,8 +290,8 @@ double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long lon
|
|||||||
|
|
||||||
#ifdef USE_DIGEST
|
#ifdef USE_DIGEST
|
||||||
if (digest) {
|
if (digest) {
|
||||||
EVP_DigestFinal_ex(&mdctx, md_value, &md_len);
|
EVP_DigestFinal_ex(mdctx, md_value, &md_len);
|
||||||
EVP_MD_CTX_cleanup(&mdctx);
|
EVP_MD_CTX_free(mdctx);
|
||||||
|
|
||||||
for(i=0; i<md_len; i++)
|
for(i=0; i<md_len; i++)
|
||||||
sprintf(digest_str+(i*2), "%02x", md_value[i]);
|
sprintf(digest_str+(i*2), "%02x", md_value[i]);
|
||||||
|
@ -23,7 +23,7 @@ char *tsm_printerr(dsUint32_t dsmHandle, dsInt16_t rc) {
|
|||||||
char rcStr[DSM_MAX_RC_MSG_LENGTH];
|
char rcStr[DSM_MAX_RC_MSG_LENGTH];
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
s = malloc(sizeof(rcStr));
|
s = malloc(DSM_MAX_RC_MSG_LENGTH+5);
|
||||||
|
|
||||||
if (rc == DSM_RC_WILL_ABORT) {
|
if (rc == DSM_RC_WILL_ABORT) {
|
||||||
dsUint16_t reason;
|
dsUint16_t reason;
|
||||||
|
Reference in New Issue
Block a user