Hello Phil,

On 2020-12-15 18:10, Eric Bollengier via Bacula-devel wrote:
> Hello,
> 
>>
>> Compilation fails on Solaris 11.3 using Solaris Studio 12.6.
>>
> 
> I would recommend to compile with GCC, it is free and available on all
> platforms. Of course, patches are welcome to support an other compiler.

Can you try the attached patch? Might not be too complicated. (at least
for the msg/msglen variables, for the ser/unser macro, it can be more
complicated and might require more study).

Best Regards,
Eric

>>
>> Compiling bsockcore.c
>> "bsockcore.c", line 64: Warning: msg hides BSOCKCORE::msg.
>> "bsockcore.c", line 64: Warning: msglen hides BSOCKCORE::msglen.
>> "bsockcore.c", line 88: Error: Badly formed expression.
>> "bsockcore.c", line 98: Error: Badly formed expression.
>> "bsockcore.c", line 101: Error: Badly formed expression.
>> 3 Error(s) and 2 Warning(s) detected.
>> make[1]: *** [bsockcore.lo] Error 1
>> make[1]: Leaving directory `/netstore/src/bacula-11.0.0/src/lib'
>>
>>
>> Looks like the problem lies in unser_assign().
>>
>>
> 
> 

>From 25c5f036bb5532720b60abf5dd2b0e3215fb1bb5 Mon Sep 17 00:00:00 2001
From: Eric Bollengier <e...@baculasystems.com>
Date: Tue, 15 Dec 2020 18:13:23 +0100
Subject: [PATCH] Fix compilation issue with Solaris Studio

---
 bacula/src/lib/bsockcore.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/bacula/src/lib/bsockcore.c b/bacula/src/lib/bsockcore.c
index 28efbeae3a..696ebc3658 100644
--- a/bacula/src/lib/bsockcore.c
+++ b/bacula/src/lib/bsockcore.c
@@ -61,14 +61,14 @@ static void win_close_wait(int fd);
  * make a nice dump of a message
  */
 void BSOCKCORE::dump_bsock_msg(int sock, uint32_t msgno, const char *what, uint32_t rc, int32_t pktsize, uint32_t flags,
-                               POOLMEM *msg, int32_t msglen)
+                               POOLMEM *amsg, int32_t amsglen)
 {
    char buf[54];
    bool is_ascii;
    int dbglvl = DT_NETWORK;
 
-   if (msglen<0) {
-      Dmsg5(dbglvl, "0x%p: %s %d:%d SIGNAL=%s\n", this, what, sock, msgno, bnet_sig_to_ascii(msglen));
+   if (amsglen<0) {
+      Dmsg5(dbglvl, "0x%p: %s %d:%d SIGNAL=%s\n", this, what, sock, msgno, bnet_sig_to_ascii(amsglen));
    } else if (flags & BNET_IS_CMD) {
       /* this is a command */
       int32_t command;
@@ -79,15 +79,15 @@ void BSOCKCORE::dump_bsock_msg(int sock, uint32_t msgno, const char *what, uint3
       char *block;
       int hash_size;
       unser_declare;
-      unser_begin(msg, msglen);
+      unser_begin(amsg, amsglen);
       unser_int32(command);
       switch (command) {
       case BNET_CMD_GET_HASH:
       case BNET_CMD_ACK_HASH:
       case BNET_CMD_UNK_HASH:
          unser_assign(hash, sizeof(int)); /* I use only 4 bytes of the hash */
-         unser_end(msg, msglen);
-         Dmsg6(dbglvl, "%s %d:%d %s len=%ld #%08x\n", what, sock, msgno, bnet_cmd_to_name(command), msglen, hash2int(hash));
+         unser_end(amsg, amsglen);
+         Dmsg6(dbglvl, "%s %d:%d %s len=%ld #%08x\n", what, sock, msgno, bnet_cmd_to_name(command), amsglen, hash2int(hash));
          break;
       case BNET_CMD_STO_BLOCK:
          /* unfortunately we don't know the hash size and don't know the offset
@@ -96,10 +96,10 @@ void BSOCKCORE::dump_bsock_msg(int sock, uint32_t msgno, const char *what, uint3
           */
          hash_size=bhash_info(DEDUP_DEFAULT_HASH_ID, NULL);
          unser_assign(hash, hash_size); /* I only display the 4 first byte of the hash */
-         size=msglen-(BNET_CMD_SIZE+hash_size);
+         size=amsglen-(BNET_CMD_SIZE+hash_size);
          if (size>0) {
             unser_assign(block, size);
-            unser_end(msg, msglen);
+            unser_end(amsg, amsglen);
             smartdump(block, size, buf, sizeof(buf)-9, &is_ascii);
          } else {
             buf[0] = '\0';
@@ -114,22 +114,22 @@ void BSOCKCORE::dump_bsock_msg(int sock, uint32_t msgno, const char *what, uint3
       case BNET_CMD_REC_ACK:
          unser_int32(capacity);
          unser_int64(counter);
-         unser_end(msg, msglen);
+         unser_end(amsg, amsglen);
          Dmsg6(dbglvl, "%s %d:%d %s cnt=%lld cap=%ld\n", what, sock, msgno, bnet_cmd_to_name(command), counter, capacity);
          break;
       case BNET_CMD_NONE:
       case BNET_CMD_STP_THREAD:
       default:
-         Dmsg5(dbglvl, "%s %d:%d %s len=%ld\n", what, sock, msgno, bnet_cmd_to_name(command), msglen);
+         Dmsg5(dbglvl, "%s %d:%d %s len=%ld\n", what, sock, msgno, bnet_cmd_to_name(command), amsglen);
          break;
       }
    } else {
       // data
-      smartdump(msg, msglen, buf, sizeof(buf)-9, &is_ascii);
+      smartdump(amsg, amsglen, buf, sizeof(buf)-9, &is_ascii);
       if (is_ascii) {
-         Dmsg6(dbglvl, "0x%p: %s %d:%d len=%d \"%s\"\n", this, what, sock, msgno, msglen, buf);
+         Dmsg6(dbglvl, "0x%p: %s %d:%d len=%d \"%s\"\n", this, what, sock, msgno, amsglen, buf);
       } else {
-         Dmsg6(dbglvl, "0x%p: %s %d:%d len=%d %s\n", this, what, sock, msgno, msglen, buf);
+         Dmsg6(dbglvl, "0x%p: %s %d:%d len=%d %s\n", this, what, sock, msgno, amsglen, buf);
       }
    }
 }
-- 
2.29.2


_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to