[ostree] trivial-httpd: Handle the autoexit case when the docroot is a symlink



commit 14c9f88e9c8988e18429872cd3f2684e01301a5d
Author: Vivek Dasmohapatra <vivek collabora co uk>
Date:   Thu Aug 22 19:44:29 2013 +0100

    trivial-httpd: Handle the autoexit case when the docroot is a symlink

 src/ostree/ot-builtin-trivial-httpd.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/ostree/ot-builtin-trivial-httpd.c b/src/ostree/ot-builtin-trivial-httpd.c
index 3c8fff9..9607f4d 100644
--- a/src/ostree/ot-builtin-trivial-httpd.c
+++ b/src/ostree/ot-builtin-trivial-httpd.c
@@ -342,7 +342,23 @@ ostree_builtin_trivial_httpd (int argc, char **argv, GFile *repo_path, GCancella
   app->running = TRUE;
   if (opt_autoexit)
     {
-      dirmon = g_file_monitor_directory (app->root, 0, cancellable, error);
+      gboolean is_symlink = FALSE;
+      gs_unref_object GFileInfo *info = NULL;
+
+      info = g_file_query_info (app->root,
+                               G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK,
+                               G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                               cancellable, error);
+      if (!info)
+        goto out;
+
+      is_symlink = g_file_info_get_is_symlink (info);
+
+      if (is_symlink)
+        dirmon = g_file_monitor_file (app->root, 0, cancellable, error);
+      else
+        dirmon = g_file_monitor_directory (app->root, 0, cancellable, error);
+
       if (!dirmon)
         goto out;
       g_signal_connect (dirmon, "changed", G_CALLBACK (on_dir_changed), app);


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