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

Re: [PATCH v2 1/2] tools/xenstore: add const to the return type of canonicalize()



Hi,

On 24/07/2023 08:10, Juergen Gross wrote:
On 22.07.23 18:44, Julien Grall wrote:


On 22/07/2023 16:20, Julien Grall wrote:
Hi Juergen,

On 22/07/2023 09:16, Juergen Gross wrote:
-static struct watch *add_watch(struct connection *conn, char *path, char *token,
-                   bool relative, bool no_quota_check)
+static struct watch *add_watch(struct connection *conn, const char *path,
+                   const char *token, bool relative,
+                   bool no_quota_check)
  {
      struct watch *watch;
@@ -218,12 +219,14 @@ int do_watch(const void *ctx, struct connection *conn, struct buffered_data *in)
  {
      struct watch *watch;
      char *vec[2];
+    const char *path;
      bool relative;
      if (get_strings(in, vec, ARRAY_SIZE(vec)) != ARRAY_SIZE(vec))
          return EINVAL;
-    errno = check_watch_path(conn, ctx, &(vec[0]), &relative);
+    path = vec[0];
+    errno = check_watch_path(conn, ctx, &path, &relative);

 From my understanding, check_watch_path() could update vec[0] which is then used below. But with your change, vec[0] would not be updated anymore.

I can see two possible approach:
    1) get_strings() is taking a const as well

I have a patch doing this. I will send it on Monday.

Hmm, looking at this I think this will collide with my patch.

Yes, it will for check_watch_patch().


Would you mind me doing the conversion of get_strings() in my patch, too?

Sure.

Cheers,

--
Julien Grall



 


Rackspace

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