]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Fixed running <path>/<binary> when building absolute path for doveconf -e.
authorTimo Sirainen <tss@iki.fi>
Wed, 6 May 2009 19:22:35 +0000 (15:22 -0400)
committerTimo Sirainen <tss@iki.fi>
Wed, 6 May 2009 19:22:35 +0000 (15:22 -0400)
--HG--
branch : HEAD

src/lib-master/master-service-settings.c

index d3a90e1a151d9009433e02bad40857f4e8324094..53cec8f6976ba719d1f4d1a8a2b9b88f6aa194db 100644 (file)
@@ -56,10 +56,17 @@ static void ATTR_NORETURN
 master_service_exec_config(struct master_service *service, bool preserve_home)
 {
        const char **conf_argv, *path, *const *paths, *binary_path;
+       char full_path[PATH_MAX];
 
        binary_path = service->argv[0];
-       path = getenv("PATH");
-       if (*service->argv[0] != '/' && path != NULL) {
+       if (*service->argv[0] == '/') {
+               /* already have the path */
+       } else if (strchr(service->argv[0], '/') != NULL) {
+               /* relative to current directory */
+               if (realpath(service->argv[0], full_path) == NULL)
+                       i_fatal("realpath(%s) failed: %m", service->argv[0]);
+               binary_path = full_path;
+       } else if ((path = getenv("PATH")) != NULL) {
                /* we have to find our executable from path */
                paths = t_strsplit(path, ":");
                for (; *paths != NULL; paths++) {