[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] tools/9pfsd: Fix build error caused by strerror_r()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Henry Wang <xin.wang2@xxxxxxx>
  • Date: Thu, 7 Mar 2024 20:44:24 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z1tEW7MOkAIHsGVkrducJxUr8jRNcyh6yysEubrAtEo=; b=L73Y0C7f+6EOWtYZiCUEWJQsSPjlYohoqFxzdj5gbZpS8pPo8uijDotI1r+xmknXn3cG/fd1jVBnA1WW816+aokNRFZKgj69bQpTFY7XS4Z1RUJJZgIJgeP+KMUStIR2c5Uyj1yR5hLzYFdsrN+t/B/36I2VK0mWDSL/F+OItilsWT3SRoqKFbAeDVxGy3Cv9FBmjvkxWyTSjxpPlYYXJKfZ4ZUZXeopAGaobDXKP97dpfOOjfAe0W2OxIL5QCaEw786KgQ2+qXwh+JRchOT+ofmDrjliTmMZXIRoDAoqnLqu7JbUwCMdhqMFGGIRj7ufEEos/JqNBNKWFrterqlJA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Efe5HahjTkY8+5D7nmhm+VG6vfxltcEwlvw8IkYtoI0FUrXvN6Hs/9BIT/926KMGGvI+wyrtHJwtobIbs4S1z/pY4zy+4SAAW3jQVM3YowePgOvpUJ83pYTgCItQkc7hgyQAxFQu6rG4M44bYgpFNueylxe4E5pQUoif/+6tqLSXcOrNts7THfnjgGbgiPZuI0LVyU6wUSvmNfF/HgAdxc0VAM5bskfFielOOSio/sEHBW0frhF++Lqzx3ELpTt3vJikzSd7292FnOcKSNSjS90eSSDx4APEkmqfz1FeeBY3zH/qFC4YYUa+QMsP5VuCE8bxZekMtUtOS4HFrsNPkg==
  • Cc: Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 07 Mar 2024 12:44:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 3/7/2024 8:19 PM, Henry Wang wrote:
     len = min(strlen(str), ring->ring_size - 1);

This actually will fire below errors on my build env, hence I separated them with a different variable.

tools/include/xen-tools/common-macros.h:38:21: error: comparison of distinct pointer types lacks a cast [-Werror]
|    38 |         (void) (&_x == &_y); \
|       |                     ^~
| io.c:695:11: note: in expansion of macro 'min'
|   695 |     len = min(strlen(str), MAX_ERRSTR_LEN - 1);;
|       |           ^~~
| cc1: all warnings being treated as errors

     memcpy(ring->buffer, str, len);
     ((char *)ring->buffer)[len] = '\0';
     pthread_mutex_unlock(&mutex);

I will follow your style in V3 if you don't have any specific comment on the error that I posted above (plus also not strongly disagree with my approach in v2).

In fact I think
```
len = min(strlen(str), (size_t)(MAX_ERRSTR_LEN - 1));
```
is better.

Kind regards,
Henry

Kind regards,
Henry

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.